Correcting teacher:灭绝师太
Correction status:qualified
Teacher's comments:
1.第一题
$data = [['name'=>'zhangdan','id'=>2],['name'=>'lisi','id'=>1]];
$arr = [];
foreach ($data as $s => $v) {
$arr[$s]['user'] = $data[$s]['name'];
$arr[$s]['id'] = $data[$s]['id'];
}
echo "<pre>";
$data = $arr;
print_r($data);
`
2.第二题
$arr = range(1,100);
function odd($var)
{
// 返回输入整数是否为奇数(单数)
return $var & 1;
};
echo '<pre>';
print_r(array_values(array_filter($arr, "odd")));