11-13-2007, 07:05 AM
|
#2 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Posts: 360
Thanks: 24
|
Quote:
Originally Posted by CMellor
Hey, was fooling around with some array functions, and just wondered...
Ya know how array_push adds a new value to your array? Can it also add a key, because I tried:
PHP Code:
array_push($array, 'Chris' => 'Mellor');
but got an error.
I'm sure it's possible, anybody an idea?
|
http://php.net/array_push
Quote:
|
Note: If you use array_push() to add one element to the array it's better to use $array[] = because in that way there is no overhead of calling a function.
|
You can use $aArray['Chris'] = 'Mellor'; .
|
|
|
|