Welcome to WebmasterWorld Guest from 50.16.78.128

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

variable variables & arrays

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

5+ 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?
4:20 pm on Jan 18, 2012 (gmt 0)

5+ Year Member



I got it -- it should be:

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