Voting

: max(seven, one)?
(Example: nine)

The Note You're Voting On

cHao
12 years ago
In case you were wondering (cause i was), anonymous functions can return references just like named functions can.  Simply use the & the same way you would for a named function...right after the `function` keyword (and right before the nonexistent name).

<?php
    $value = 0;
    $fn = function &() use (&$value) { return $value; };

    $x =& $fn();
    var_dump($x, $value);        // 'int(0)', 'int(0)'
    ++$x;
    var_dump($x, $value);        // 'int(1)', 'int(1)'

<< Back to user notes page

To Top