324...@mail.muni.cz hat am 1. Juni 2012 um 21:52 geschrieben:

> 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.

You can find anything on that topic on the type hint section.
If you use type hinting:

Classname $a,

$a can only be instance of Classname, nothing else. But if you want to allow
null as well, you have to write

Classname $a = null,

Don't mistake this as default value! It is _meant_ as "Classname or null" are

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

Reply via email to