note 71580 added to functions.arguments
| From: | johnfactorial at gmail dot com | Date: | Wed, 06 Dec 2006 17:50:26 +0000 |
| Subject: | note 71580 added to functions.arguments | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120345@lists.php.net to get a copy of this message | ||
Note that you can't skip one parameter with a default value and specify the value of another
one. E.g.:
function foo($a, $b=3, $c=5) {
echo "foo: $a, $b, $c";
}
foo(1); //works fine
foo(1, 2); //also works fine
But, if you want to specify a value for $a and $c but not $b, there is no straightforward way to do
it.
foo(1, , 3); //parse error
foo(1, null, 3); //$b = null
----
Server IP: 64.71.164.2
Probable Submitter: 63.172.193.57
----
Manual Page -- http://www.php.net/manual/en/functions.arguments.php
Edit -- https://master.php.net/note/edit/71580
Del: integrated -- https://master.php.net/note/delete/71580/integrated
Del: useless -- https://master.php.net/note/delete/71580/useless
Del: bad code -- https://master.php.net/note/delete/71580/bad+code
Del: spam -- https://master.php.net/note/delete/71580/spam
Del: non-english -- https://master.php.net/note/delete/71580/non-english
Del: in docs -- https://master.php.net/note/delete/71580/in+docs
Del: other reasons-- https://master.php.net/note/delete/71580
Reject -- https://master.php.net/note/reject/71580
Search -- https://master.php.net/manage/user-notes.php