note 76727 deleted from language.references.pass by googleguy
| From: | googleguy@php.net | Date: | Sun, 23 Feb 2014 17:21:00 +0000 |
| Subject: | note 76727 deleted from language.references.pass by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-198607@lists.php.net to get a copy of this message | ||
Note Submitter: sony-santos at bol dot com dot br
----
Just another workaround for default values to parameters by ref in response to mogmios, bobbykjack,
andrzej, fdelizy, petruzanautico, Train Boy, and php community.
<?php
# php 4.3.10
# note there's no & in function declaration:
function f($a = array('default value')) {
$a[0] .= " processed<br/>";
echo $a[0];
}
f(); # default value processed
$b = 'foo';
f(array(&$b)); # foo processed (note the & here)
echo $b; # foo processed
?>