note 16599 added to function.get-defined-vars
| From: | matt at followers dot net | Date: | Mon, 05 Nov 2001 22:02:57 +0000 |
| Subject: | note 16599 added to function.get-defined-vars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-20500@lists.php.net to get a copy of this message | ||
<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>
--
http://www.php.net/manual/en/function.get-defined-vars.php
http://master.php.net/manage/user-notes.php?action=edit+16599
http://master.php.net/manage/user-notes.php?action=delete+16599
http://master.php.net/manage/user-notes.php?action=reject+16599