note 42095 deleted from functions.arguments by tomsommer
| From: | tomsommer@php.net | Date: | Sun, 27 Jun 2004 02:14:14 +0000 |
| Subject: | note 42095 deleted from functions.arguments by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71849@lists.php.net to get a copy of this message | ||
Note Submitter: kermodebear at kermodebear dot org
----
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!