note 16599 deleted from function.get-defined-vars by sniper
| From: | sniper@php.net | Date: | Sat, 23 Aug 2003 00:08:22 +0000 |
| Subject: | note 16599 deleted from function.get-defined-vars by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54898@lists.php.net to get a copy of this message | ||
Note Submitter: matt@followers.net
----
<p>It appears that get_defined_vars() passes by value, not by
reference.</p><p>this chunk of code:
$a = "Hello";
echo "$a \n";
$arr = get_defined_vars();
echo $arr["a"]." \n";
$arr["a"] = "Goodbye";
echo $arr["a"]." \n";
echo "$a \n";
<p>produces this output:
Hello
Hello
Goodbye
Hello
<p>You can't change the value of $a by setting $args["a"]. I'm very
thankful to have this function, even if it's mostly useful for debugging purposes.</p>