Jas*_*jal 5 php operator-keyword
$array1 = array("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5);
print_r(array_filter($array1, "odd"));
function odd($var)
{
// returns whether the input integer is odd//
return($var & 1);
}
Run Code Online (Sandbox Code Playgroud)
在返回值中有什么操作&符?它如何返回奇数
它是按位运算符AND.
例如, ($a & $b)评估两者$a并$b打开"(即等于1)
见:http://www.php.net/manual/en/language.operators.bitwise.php