Am 22.07.2008 um 16:37 schrieb Richard Quadling:

Actually, would allowing PHP to skip defaulted parameters be a better
facility to add?

function foo($opt1 = Null, $opt2 = Null){}

foo(,True);

Hmm. Doesn't look good does it. But, useful. Having to supply the default
value if you don't want to override the default is sort of
counter-intuitive. Suppling nothing should equal the default value.

That would be totally brilliant, since it means that one wouldn't have to know the default value in order to skip an argument.

We looked into this a couple of months ago and the info I got from the engineer that dug into the code was that it would be relatively complicated to implement in the engine (we were considering a keyword back then, sth like foo(default, true);).

But if it can be done... I'm all for it. It's definitely useful.

David


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

Reply via email to