Blogger Information
Blog 15
fans 0
comment 0
visits 7786
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
0805作业
ッ小眼睛っ
Original
361 people have browsed it
  1. <?php
  2. // 给定一个数组$arr = [23,3,45,6,78,8,34],筛选其偶数成员组成新的数组返回
  3. $arr = [23,3,45,6,78,8,34];
  4. $arr1=[];
  5. foreach ($arr as $v){
  6. if(($v % 2) == 0) {
  7. $arr1[].= $v;
  8. echo $v . '<br>';
  9. }
  10. }
  11. var_dump($arr1);
  12. //2. 尝试实现简单的计算器功能,语言不限制。
  13. function Calculator(string $Symbol,int $number,int $number1)
  14. {
  15. switch ($Symbol){
  16. case '+':
  17. return $number+$number1;
  18. break;
  19. case '-':
  20. return $number-$number1;
  21. break;
  22. case '*':
  23. return $number*$number1;
  24. break;
  25. case '/':
  26. return $number/$number1;
  27. break;
  28. default:
  29. return '指令不正确';
  30. }
  31. }
  32. var_dump(Calculator('0',10,5));
Correcting teacher:灭绝师太灭绝师太

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post