note 18657 added to function.array-push
| From: | Anonymous at poster dot com | Date: | Wed, 30 Jan 2002 21:06:24 +0000 |
| Subject: | note 18657 added to function.array-push | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26043@lists.php.net to get a copy of this message | ||
Regarding:
Carl wrote that: "array_push() doesn't seem to allow you to push a key=>value pair onto
the array."
The correct syntax for this would be:
$array['newkey']=$newvalue;
You should not need the array_push function, but if so the example should read:
array_push($myarray,array("mykey"=>"myvalue"));
This will not return a syntax error.
--
http://www.php.net/manual/en/function.array-push.php
http://master.php.net/manage/user-notes.php?action=edit+18657
http://master.php.net/manage/user-notes.php?action=delete+18657
http://master.php.net/manage/user-notes.php?action=reject+18657