note 30322 deleted from function.array-push by philip
| From: | philip@php.net | Date: | Fri, 09 Oct 2009 16:40:23 +0000 |
| Subject: | note 30322 deleted from function.array-push by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161599@lists.php.net to get a copy of this message | ||
Note Submitter: daevid at daevid dot com
----
Just to fix and clean up the above example... it should be:
<?php
function addArray(&$array, $key, $val)
{
$tempArray = array($key => $val);
$array = array_merge ($array, $tempArray);
}
?>
and use this to view them:
<?php
foreach ($myArray as $key=>$val)
{
echo "key = ".$key." val = ".$val;
}
?>