note 57949 deleted from function.array-push by betz
| From: | betz@php.net | Date: | Tue, 01 Nov 2005 07:28:50 +0000 |
| Subject: | note 57949 deleted from function.array-push by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97909@lists.php.net to get a copy of this message | ||
Note Submitter: john
----
Revised associative_push function with absolute reference of arg1 array; left unchanged if arg2 is
empty.
// append associative array elements
function associative_push(&$arr, $tmp) {
if (is_array($tmp)) {
foreach ($tmp as $key => $value) {
$arr[$key] = $value;
}
}
}
$theArray = array();
associative_push($theArray, $items);