Re: Name of an array???
| From: | Steve Edberg | Date: | Mon, 09 Jul 2001 18:32:33 +0000 |
| Subject: | Re: Name of an array??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56990@lists.php.net to get a copy of this message | ||
Not quite sure what you're getting at here. As you discovered, if you have
$Thing = array(5,6,7,8);
and you 'echo $Thing;' you get 'Array.' However, in this case, you know the variable name already - $Thing!
Are you thinking more along these lines:
$ArrayName = 'Thing';
$$ArrayName = array(5,6,7,8);
now,
echo $ArrayName; ==> Thing
echo $$ArrayName; ==> Array
echo ${$ArrayName}[0]; ==> 5
See
http://www.php.net/manual/en/language.variables.variable.php
for more info.
-steve
At 1:03 PM -0700 7/9/01, Dallas K. wrote:
I need to echo the NAME of an array to the browser..... when I try this all I get is "Array"..... when I try to : echo $$array_name; I get nothing. How can I get the NAME of an array to the browser? Thanks.-- +------ Factoid: Of the 100 largest economies in the world, 51 are ------+ | Steve Edberg University of California, Davis | | sbedberg@ucdavis.edu Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +--- corporations ------ http://www.ips-dc.org/reports/top200text.htm ---+