note 42095 added to functions.arguments
| From: | kermodebearatkermodebeardotorg at rn2 dot php dot net | Date: | Mon, 03 May 2004 14:18:15 +0000 |
| Subject: | note 42095 added to functions.arguments | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69144@lists.php.net to get a copy of this message | ||
To kieran at kieran dot ca :
Your initial code does not work because default value must be a static value. From the manual:
"The default value must be a constant expression, not (for example) a variable, a class member
or a function call."
So, a default value cannot be sest to another variable.
There are a lot of work arounds for this, including your method. Setting default parameters to FALSE
then using === to compare works well, as does using func_num_args() in some cases. The best solution
will, of course, depend on the problem.
Hope this helps someone out there!
----
Manual Page -- http://www.php.net/manual/en/functions.arguments.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42095
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42095&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42095&report=yes
Search -- http://master.php.net/manage/user-notes.php