Sean Coates wrote:
Jason Garber wrote:

function setor(&$param, $default)
{
    return (isset($param) ? $param : $default);
}

I tested it on 4.3.4 and 5.0 RC1, and it worked. Is passing an undefined variable as a reference parameter a legal thing to do in PHP?


That bring up an interesting point:

error_reporting(E_ALL);
function test_func(&$oink)
{
  echo $oink;
}
test_func($moo);


executing this block does not fire an E_NOTICE.


S

So, how I see the code:
inside the function you have already a variable named $oink so there won't be a E_NOTICE for unknown var. The variable is "linked" to somewhere outside but that doesn't matter.
I think it has in common with the unset() behaviour on variables visible with "global" keyword.


Andrey

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to