Hello all.

Howcome I can create an array on a variable variable using array(), but not
in a for-loop (See code below)?

<?
$name = "talltorp";

$$name = array(1,2,3,4);  // <-- this works

for ($i=0; $i<10; $i++) { //
    $$name[] = $i;        // <-- this does not work
}                         //

for ($i=0; $i<sizeof($talltorp); $i++)

    echo $talltorp[$i];
}
?>

In the for-loop I get this error message:
Fatal error: Cannot use [] for reading in
E:\Inetpub\wwwroot\testscript\sessions\test4.php on line 6

Is this a bug or do I have the bugs in my head finally gotten to my thinking
area?

Thanks,
// Tobias Talltorp



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to