Variable name into string

From: Date: Wed, 18 Jul 2001 14:30:39 +0000
Subject: Variable name into string
Groups: php.general 
Request: Send a blank email to php-general+get-58442@lists.php.net to get a copy of this message
Hello, Manual and news group search returned to result on this topic. (or May be I miss something.) The objective : to be able to identify (print, compare, etc.) variable name as a String to be able to override class method based on variable name. Variable will be an associative array. Consider the following class method reconstraction : <?php $variable = array(); # I CAN NOT do variable variables thing here like function ($$variable) { if ($variable = "Text") { $result = "<input type=\"text\" "; foreach ($$variable as $prop=>$value) { $result .= "$prop=\"$value\" "; } $result .=">"; return $result; } elseif {($variable = "Area") $result = "<textarea "; foreach ($properties as $prop=>$value) { $result .= "$prop=\"$value\" "; } $result .=">"; return $result; } } ?> QUESTION: It is any way to extract "variable" string from $variable ? Thank you very much for any helpfull input regarding topic. Maxim Volkov

« previous php.general (#58442) next »