2009/7/6 Lupus Michaelis <mickael+php@xxxxxxxxxxxx>: > 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 ? You appear to be using the definition of null that comes from the world of C. A null in PHP is not the same as a null in C - it's a real value (of type null), not the absence of a value. So what you're doing is the equivalent of passing a literal value, something you can't do when the function is expecting a reference. See the manual for more info on the null type: http://php.net/null -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php