note 108492 deleted from functions.arguments by danbrown

From: Date: Thu, 10 May 2012 16:54:20 +0000
Subject: note 108492 deleted from functions.arguments by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-187609@lists.php.net to get a copy of this message
Note Submitter: bee kay two at em ee dot com ---- Regarding example 5: function makeyogurt($type = "acidophilus", $flavour) { return "Making a bowl of $type $flavour.\n"; } echo makeyogurt("raspberry"); // won't work as expected Why the restriction on order? Just because C++ is mega arbitrary, php has to be? Simple, non-ambiguous use of position independent default: echo makeyogurt(, "raspberry"); // empty 1st argument // before comma means take default. Then defaults can appear in any argument, because when defaults are needed in the real world is not neatly ordered.

« previous php.notes (#187609) next »