Brackets in key name of array

Hi!
PHP is giving error. But I have to use brackets in key of array.


    $data['user[login]']        = 'abc';
    $data['user[password]']  = '123';

How can I correct it .

Thanks in advance

i have a feeling that proper way of doing is double dimensional array…
but need to look in to some more of the code snipplet of that(why it is actually done that way)

Try:

    $data['user']['login']        = 'abc';
    $data['user']['password']  = '123';

i dont think that is going to work unless the array was initially created that way…
that is why i am saying we need to see the other part of the code as well…

What’s the error?

sorry this is error on my part as i was thinking he actually is trying to access that value …infact he is assigning a value to array element…
so above code will definately work and is right way of doing it…
(not edit/delete post feature here…:slight_smile: )