相关疑难解决方法(0)

Reference — What does this symbol mean in PHP?

What is this?

This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this list.

Why is this?

It used to be hard to find questions about operators and other syntax tokens.¹
The main idea is to have links to existing questions on Stack Overflow, so it's easier for us to reference them, not to copy over content from …

php arguments symbols operators

4314
推荐指数
21
解决办法
63万
查看次数

回调函数返回 return($var & 1)?

我已经阅读了关于array_filter的 PHP手册

<?php
function odd($var)
{
    // returns whether the input integer is odd
    return($var & 1);
}

function even($var)
{
    // returns whether the input integer is even
    return(!($var & 1));
}

$array1 = array("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5);
$array2 = array(6, 7, 8, 9, 10, 11, 12);

echo "Odd :\n";
print_r(array_filter($array1, "odd"));
echo "Even:\n";
print_r(array_filter($array2, "even"));
?>
Run Code Online (Sandbox Code Playgroud)

即使我在这里看到结果:

Odd :
Array
(
    [a] => 1
    [c] => 3
    [e] => 5
)
Even:
Array
( …
Run Code Online (Sandbox Code Playgroud)

php bitwise-operators

3
推荐指数
1
解决办法
2805
查看次数

标签 统计

php ×2

arguments ×1

bitwise-operators ×1

operators ×1

symbols ×1