Forum Moderators: coopster

Message Too Old, No Replies

variable variables & arrays

         

sssweb

4:13 pm on Jan 18, 2012 (gmt 0)

10+ Year Member



I have the code:

$name = array();
$x = 'name';
$$x[] = 'value';

I get this error on the last line:

"Cannot use [] for reading..."

Why?

sssweb

4:20 pm on Jan 18, 2012 (gmt 0)

10+ Year Member



I got it -- it should be:

${$x}[] = 'value';