On Fri, Jun 1, 2012 at 9:52 PM, <324706@xxxxxxxxxxxx> wrote: > Hi, > > as I accidentally found out that PHP allows default argument values > to occur not only at the end of parameter list: > > function ( Classname $a, Classname $b = null, Classname $c ) ... > > Unfortunately, documentation does not state what is supposed to happen in > such situation. > It appears $b can be an instance of Classname or a null. > > I've draw up simple test case (https://gist.github.com/2829626) to verify my > assumption > and it seems to work at least since PHP 5.3.0. It is extremely useful to > allow null > value and retain the power of type hints at the same time. > > Is there anything else to test? Does it work for your setup? Can it be used > that way? > And if yes, can it be officially documented? > > Do not hesitate to prove I'm wrong. > > -- Oliver > Hi Oliver, I think the example at [1] demonstrates that it is possible, but it also notes that it is pretty useless. Why are you interested in this? - Matijn [1] http://www.php.net/manual/en/functions.arguments.php#example-153 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php