note 9699 added to Variable variables
| From: | chip at alumni dot cuhk dot edu dot hk | Date: | Mon, 20 Nov 2000 08:11:30 +0000 |
| Subject: | note 9699 added to Variable variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7907@lists.php.net to get a copy of this message | ||
You can't create an array using variable variables!
example:
$n="a"
$$n=12
echo($a);
this will work, hence, $a = 12;
however,
$n="a[0]";
$$n=12;
$n="a[1]";
$$n=24;
echo(count($a).",".$a[0].",".$a[1]);
I expected the output to be: 2,12,24
However, actually this output nothing but three ","s.
http://www.php.net/manual/language.variables.variable.php