Variable array variables?
| From: | Lars Torben Wilson | Date: | Sun, 15 Oct 2000 01:41:02 +0000 |
| Subject: | Variable array variables? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-20187@lists.php.net to get a copy of this message | ||
I've been searching archives and the 'net all day--and my memory, but
that seems to be down at the moment--for this. Given an array like:
$foo = array (
'bar' => array (
'name' => 'Bill'
)
);
...and strings like $arr = 'foo' and $ind = '[bar][name]' (format can
be changed if needed), what would be the best way of doing something
like:
echo ${$arr . $ind};
I always get 'Undefined variable: foo[bar][name]...'
This is PHP 4.0.4-dev, CVS from about 20 minutes ago.
Is this simply beyond the parser's capabilities, or am I merely
missing an obvious syntax problem here? Either way, the answer will
make it into the manual. :)
Cheers and TIA,
Torben
--
+----------------------------------------------------------------+
|Torben Wilson <torben@php.net> Netmill iTech|
|http://www.coastnet.com/~torben http://www.netmill.fi|
|Ph: 1 250 383-9735 torben@netmill.fi|
+----------------------------------------------------------------+