note 101391 added to function.array-push
| From: | SiposTamas at osu1 dot php dot net | Date: | Tue, 14 Dec 2010 15:00:05 +0000 |
| Subject: | note 101391 added to function.array-push | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174903@lists.php.net to get a copy of this message | ||
Instead of
<?php
array_push($array, "new_item");
?>
you can always use
<?php
$array[count($array)] = "new_item";
?>
to add one more item onto the end of an array
IN CASE: It is a "usual" array. By that I mean: a numeric array, which keys start with 0,
and rising one by one with no items missing.
----
Server IP: 69.147.83.197
Probable Submitter: 188.20.253.186
----
Manual Page -- http://www.php.net/manual/en/function.array-push.php
Edit -- https://master.php.net/note/edit/101391
Del: integrated -- https://master.php.net/note/delete/101391/integrated
Del: useless -- https://master.php.net/note/delete/101391/useless
Del: bad code -- https://master.php.net/note/delete/101391/bad+code
Del: spam -- https://master.php.net/note/delete/101391/spam
Del: non-english -- https://master.php.net/note/delete/101391/non-english
Del: in docs -- https://master.php.net/note/delete/101391/in+docs
Del: other reasons-- https://master.php.net/note/delete/101391
Reject -- https://master.php.net/note/reject/101391
Search -- https://master.php.net/manage/user-notes.php