note 105280 modified in function.array-replace by danbrown
| From: | danbrown@php.net | Date: | Sun, 07 Aug 2011 15:37:36 +0000 |
| Subject: | note 105280 modified in function.array-replace by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182296@lists.php.net to get a copy of this message | ||
Yep, thinking about it replacing from back to front, this works a trick!
here's a quick repalcement for PHP <=5.3
<?php
if (!function_exists('array_replace')){ function array_replace(){
$array=array();
$n=func_num_args();
while ($n-- >0) {
$array+=func_get_arg($n);
}
return $array;
}}
?>
--was--
Yep, thinking about it replacing from back to front, this works a trick!
here's a quick repalcement for PHP <=5.3
if (!function_exists('array_replace')){ function array_replace(){
$array=array();
$n=func_num_args();
while ($n-- >0) {
$array+=func_get_arg($n);
}
return $array;
}}
http://php.net/manual/en/function.array-replace.php