note 9699 deleted from language.variables.variable by irc-html
| From: | irc-html@php.net | Date: | Sat, 19 Jan 2002 18:55:37 +0000 |
| Subject: | note 9699 deleted from language.variables.variable by irc-html | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-25205@lists.php.net to get a copy of this message | ||
[Editors note:
This doesn't work, because you try to assign a value to the variable named 'a[0]'. If
you want this kind of behaviour (execute PHP-syntax out of strings), take a look at eval()
]
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.