note 22037 modified in language.variables.variable by danbrown

From: Date: Wed, 24 Jun 2009 17:01:51 +0000
Subject: note 22037 modified in language.variables.variable by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-157419@lists.php.net to get a copy of this message
The 'dollar dereferencing' (to coin a phrase) doesn't seem to be limited to two layers, even without curly braces. Observe: <?php $one = "two"; $two = "three"; $three = "four"; $four = "five"; echo $$$$one; //prints 'five'. ?> This works for L-values as well. So the below works the same way: <?php $one = "two"; $$one = "three"; $$$one = "four"; $$$$one = "five"; echo $$$$one; //still prints 'five'. ?> NOTE: Tested on PHP 4.2.1, Apache 2.0.36, Red Hat 7.2 --was-- /*The 'dollar dereferencing' (to coin a phrase) doesn't seem to be limited to two layers, even without curly braces. Observe:*/ $one = "two"; $two = "three"; $three = "four"; $four = "five"; echo $$$$one; //prints 'five'. /*This works for L-values as well. So the below works the same way:*/ $one = "two"; $$one = "three"; $$$one = "four"; $$$$one = "five"; echo $$$$one; //still prints 'five'. /*NOTE: PHP 4.2.1, Apache 2.0.36, Red Hat 7.2*/ http://php.net/manual/en/language.variables.variable.php

« previous php.notes (#157419) next »