note 83298 modified in language.references.pass by danbrown
| From: | danbrown@php.net | Date: | Thu, 28 Jan 2010 13:17:36 +0000 |
| Subject: | note 83298 modified in language.references.pass by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165412@lists.php.net to get a copy of this message | ||
New in PHP5: assign default value to
pass-by-reference paramter.
I didn't believe it even when I read
http://devzone.zend.com/article/1714-Whats-New-in-PHP-5
Then I tried this:
<?php
function my_func(&$arg = 22) {
if ($arg == 22) {
print '$arg is '. $arg;
}
}
my_func();
?>
Guess what? It works, even tho' not clear about what $arg is actually referencing!
--was--
New in PHP5: assign default value to
pass-by-reference paramter.
I didn't believe it even when I read
http://devzone.zend.com/article/1714-Whats-New-in-PHP-5
Then I tried this:
function my_func(&$arg = 22) {
if ($arg == 22) {
print '$arg is '. $arg;
}
}
my_func();
Guess what? It works, even tho' not clear about what $arg is actually referencing!
http://php.net/manual/en/language.references.pass.php