Page 1 of 1

Add to an array

Posted: Wed May 02, 2007 7:00 pm
by SmokyBarnable
I have this array

Code: Select all

$array=array('a' => 1);
I want to add 'b' => 2 to the array but I don't see how to do it.

I tried

Code: Select all

array_push():
but it doesn't let me specify a key?

Posted: Wed May 02, 2007 7:03 pm
by Z3RO21

Code: Select all

$array['b'] = 2;

Posted: Wed May 02, 2007 7:05 pm
by SmokyBarnable
:o