PHP 4.0 Bug #9217: Variable Variables not "setting" as expected

From: Date: Sun, 11 Feb 2001 20:52:28 +0000
Subject: PHP 4.0 Bug #9217: Variable Variables not "setting" as expected
Groups: php.dev 
Request: Send a blank email to php-dev+get-46391@lists.php.net to get a copy of this message
From: laura@freschinfo.com Operating system: Linux PHP version: 4.0.4pl1 PHP Bug Type: Variables related Bug description: Variable Variables not "setting" as expected Defined two variable variables. Expected each to have a different value, both ended up with same value. $counter = 0; $$countrycodefinal = "ctrycode" . $counter; $$aproposfinal = "aproposCitizen" . $counter; echo ${$countrycodefinal} . "<br>"; echo ${$aproposfinal} . "<p>"; I expected the value of $$countrycodefinal to be "ctrycode0" and the value of $aaproposfinal to be "aproposCitizen0", instead BOTH ended up with the value of "aproposCitizen0". I've repeated this several times whenever I use more than one variable variable in the same script. -- Edit Bug report at: http://bugs.php.net/?id=9217&edit=1

« previous php.dev (#46391) next »