note 44907 added to functions.arguments
| From: | cerium at texas dot net | Date: | Thu, 19 Aug 2004 20:16:45 +0000 |
| Subject: | note 44907 added to functions.arguments | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74953@lists.php.net to get a copy of this message | ||
When using default parameter values, I found that the following does NOT work (at least in 4.3.3.):
myfunction($b=0){ //$b will ALWAYS be set to 0
echo $b;
}
myfunction(2);
results:
0
but this does:
myfunction($b="0"){ //$b will be whatever is passed
echo $b;
}
myfunction("2");
results:
2
----
Manual Page -- http://www.php.net/manual/en/functions.arguments.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44907
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44907&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44907&report=yes
Search -- http://master.php.net/manage/user-notes.php