note 102207 added to function.array-push
| From: | Bas at osu1 dot php dot net | Date: | Wed, 02 Feb 2011 16:43:37 +0000 |
| Subject: | note 102207 added to function.array-push | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-176599@lists.php.net to get a copy of this message | ||
Ariz Jacinto 27-Jun-2008 11:41
"if you're going to use array_push() to insert a "$key" => "$value"
pair into an array, it can be done using the following example:
array_push($data[$key], $value);"
Thats false and will give a warning.
If you want to add a key and value into an excisting array, you can simply use:
<?php
$data = array($key => $value);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 93.125.179.252
----
Manual Page -- http://www.php.net/manual/en/function.array-push.php
Edit -- https://master.php.net/note/edit/102207
Del: integrated -- https://master.php.net/note/delete/102207/integrated
Del: useless -- https://master.php.net/note/delete/102207/useless
Del: bad code -- https://master.php.net/note/delete/102207/bad+code
Del: spam -- https://master.php.net/note/delete/102207/spam
Del: non-english -- https://master.php.net/note/delete/102207/non-english
Del: in docs -- https://master.php.net/note/delete/102207/in+docs
Del: other reasons-- https://master.php.net/note/delete/102207
Reject -- https://master.php.net/note/reject/102207
Search -- https://master.php.net/manage/user-notes.php