function pick_one_side($arr, $need_odd){ return array_filter($arr, function($item) use($need_odd){ return $need_odd ? ($ item & 1) : (!($item & 1)); });} //数据筛选调用 $one_side = pick_one_side(range(1, 100), false ); print_r($one_side); 复制帽