Questionable behaviour of variable variables

From: Date: Mon, 15 Apr 2002 11:23:02 +0000
Subject: Questionable behaviour of variable variables
Groups: php.dev 
Request: Send a blank email to php-dev+get-82802@lists.php.net to get a copy of this message
Through a coding error of mine, I stumbled upon a "feature" of variable variables, that is quite sickening to me. Usually php doesn't support an empty string or integers as variable-names, but these things are all possible and you won't get a single warning...shouldn't this get changed? <?php $varname = ""; //$varname = 6; $$varname = new stdClass(); ${""}->{""} = "bar"; //${"6"}->{"6"} = "bar"; $$varname->$varname = "foo"; ?> Regards, Alexander -- Alexander Wirtz | http://www.systematics.de/ | Systematics INTEGRATIONS GmbH | fon +49 2241 39778-60 | Rathausallee 10 | fax +49 2241 39778-77 | 53757 St. Augustin | mailto:wirtz@web-active.com |

« previous php.dev (#82802) next »