note 33559 added to functions.arguments
| From: | thesibster at hotmail dot com | Date: | Mon, 30 Jun 2003 16:43:27 +0000 |
| Subject: | note 33559 added to functions.arguments | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51222@lists.php.net to get a copy of this message | ||
Call-time pass-by-ref arguments are deprecated and may not be supported later, so doing this:
----
function foo($str) {
$str = "bar";
}
$mystr = "hello world";
foo(&$mystr);
----
will produce a warning when using the recommended php.ini file. The way I ended up using for
optional pass-by-ref args is to just pass an unused variable when you don't want to use the
resulting parameter value:
----
function foo(&$str) {
$str = "bar";
}
foo($_unused_);
----
Note that trying to pass a value of NULL will produce an error.
----
Manual Page -- http://www.php.net/manual/en/functions.arguments.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33559
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33559&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33559&report=yes