php assigning by reference,passing by reference
<p>I understand there is <em>assigning by reference</em> (<code>$b = &amp;$a</code>) and <em>passing a variable by reference</em> <code>function foo( &amp;$var )</code></p>

<p>I don't understand  how this works: <code>return($var &amp; 1) &amp; return(!($var &amp; 1))</code> ? I saw this fragment <a href="http://www.php.net/manual/en/function.array-filter.php" rel="nofollow">here</a>.</p>

<pre><code>&lt;?php

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

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

    $array1 = array(1, 2, 3, 4, 5);
    $array2 = array(6, 7, 8, 9, 10, 11, 12);

    print_r(array_filter($array1, "odd"));
    // Array ( [0] =&gt; 1 [2] =&gt; 3 [4] =&gt; 5 ) //1,3,5 ..odd

    echo "&lt;br&gt;";

    print_r(array_filter($array2, "even")); 
    //Array ( [0] =&gt; 6 [2] =&gt; 8 [4] =&gt; 10 [6] =&gt; 12 ) 6,8,10,12...even

    // I tested with these variables
    echo "&lt;br&gt;&lt;br&gt;";

    $var=22;

    echo(odd($var));     //prints 0
    var_dump(odd($var)); //int 0


    $var=11;

    echo (even($var));   //prints nothing
    var_dump(even($var));//boolean false

?&gt; 
</code></pre>
