« Return to Thread: Function parameter passed by reference with default value to null

Function parameter passed by reference with default value to null

by Lupus Michaelis-2 :: Rate this Message:

Reply to Author | View in Thread

   Hi,

   I would like to know if I am alone to be shoked by this :

== 8< ==
function foo(& $bar = null)
{
}

foo() ; // runs
foo(null) ; // raise an error
== >8 ==

   Why the default value to null for a reference is allowed ? Is it a
bug, a feature ?

   Thanks !
--
Mickaƫl Wolff aka Lupus Michaelis
http://lupusmic.org

Seeking for a position <http://lupusmic.org/pro/>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

 « Return to Thread: Function parameter passed by reference with default value to null