Correcting teacher:灭绝师太
Correction status:qualified
Teacher's comments:
<?php
// 给定一个数组$arr = [23,3,45,6,78,8,34],筛选其偶数成员组成新的数组返回
$arr = [23,3,45,6,78,8,34];
$arr1=[];
foreach ($arr as $v){
if(($v % 2) == 0) {
$arr1[].= $v;
echo $v . '<br>';
}
}
var_dump($arr1);
//2. 尝试实现简单的计算器功能,语言不限制。
function Calculator(string $Symbol,int $number,int $number1)
{
switch ($Symbol){
case '+':
return $number+$number1;
break;
case '-':
return $number-$number1;
break;
case '*':
return $number*$number1;
break;
case '/':
return $number/$number1;
break;
default:
return '指令不正确';
}
}
var_dump(Calculator('0',10,5));