Defining Arrays

wxdqz

New Member
When I include the following code on my page:

$mykey = "before";
$myarray[$mykey] = "abc";

I get the error:
"cannot use a scalar value as an array"

But if I change the code to:

$mykey = "before";
$myarray = "";
$myarray[$mykey] = "abc";

It works!

How come the error is generated in the one case but not the other? Is this a bug?
 
Back
Top