Re: Echoing Variables Names

From: Date: Tue, 18 Jan 2005 04:37:29 +0000
Subject: Re: Echoing Variables Names
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-206618@lists.php.net to get a copy of this message
Phillip S. Baker wrote:
Greetings All, I am generating some variable variables. I am interested for testing purposes in finding out the names of the variables that are actually being generated. Since I want to make sure that that my following conditional statements are working properly and the values are set.
$var="var";/* nothing */echo "\$".$var."\n";/* like */$var=${"var"}; echo "\$$var\n";/* varvars */${$var."1"}="$var";${$$var}=$var; echo "\$".${$$var}."1";echo "\n";/* to */echo "\$".${${$$var}."1"}; echo "\n";/*really */echo "\$".${"var1"}."\n";/* f*** */ echo "\$".${${$var}."1"}."\n";echo "\$".${${${${${$var}}}}}."\n"; /* your */${"var"} = ${$$var}."1";echo "\$".$$var."\n";/* day */ to illustrate gregs point :-)
So is there a way to print out the name of the variables? Thanks. -- Blessed Be Phillip


« previous php.general (#206618) next »