note 29539 added to function.array-push
| From: | daevid at daevid dot com | Date: | Mon, 17 Feb 2003 02:38:20 +0000 |
| Subject: | note 29539 added to function.array-push | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44074@lists.php.net to get a copy of this message | ||
Sadly, array_push() does not create an array if the array doesn't exist. So if you're
pushing the first element onto an array, you need to check and create it manually...
if ( !is_array($myArray) ) $myArray= array();
array_push($myArray, $myElement);
--
http://www.php.net/manual/en/function.array-push.php
http://master.php.net/manage/user-notes.php?action=edit+29539
http://master.php.net/manage/user-notes.php?action=delete+29539
http://master.php.net/manage/user-notes.php?action=reject+29539