note 30322 added to function.array-push
| From: | daevid at daevid dot com | Date: | Fri, 14 Mar 2003 00:52:12 +0000 |
| Subject: | note 30322 added to function.array-push | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45282@lists.php.net to get a copy of this message | ||
Just to fix and clean up the above example... it should be:
function addArray(&$array, $key, $val)
{
$tempArray = array($key => $val);
$array = array_merge ($array, $tempArray);
}
and use this to view them:
foreach ($myArray as $key=>$val)
{
echo "key = ".$key." val = ".$val;
}
--
http://www.php.net/manual/en/function.array-push.php
http://master.php.net/manage/user-notes.php?action=edit+30322
http://master.php.net/manage/user-notes.php?action=delete+30322
http://master.php.net/manage/user-notes.php?action=reject+30322