summaryrefslogtreecommitdiff
path: root/kohana/helpers/arr.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-03-04 18:15:56 +0000
committerBharat Mediratta <bharat@menalto.com>2009-03-04 18:15:56 +0000
commit014999758e2f4efa433a9c4e71d0551e0b5b318a (patch)
tree8d15d1130c44849ddee8fcb9f6c9aa7603822b99 /kohana/helpers/arr.php
parentc0e65b202977c78c4562502373f630b8f835f1ff (diff)
Updated Kohana to r4033
Diffstat (limited to 'kohana/helpers/arr.php')
-rw-r--r--kohana/helpers/arr.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/kohana/helpers/arr.php b/kohana/helpers/arr.php
index 24b03d7f..87f2be1f 100644
--- a/kohana/helpers/arr.php
+++ b/kohana/helpers/arr.php
@@ -84,7 +84,7 @@ class arr_Core {
return $val;
}
-
+
/**
* Extract one or more keys from an array. Each key given after the first
* argument (the array) will be extracted. Keys that do not exist in the
@@ -251,13 +251,18 @@ class arr_Core {
* @param array input array(s) that will overwrite key array values
* @return array
*/
- public static function overwrite($array1)
+ public static function overwrite($array1, $array2)
{
- foreach (array_slice(func_get_args(), 1) as $array2)
+ foreach (array_intersect_key($array2, $array1) as $key => $value)
+ {
+ $array1[$key] = $value;
+ }
+
+ if (func_num_args() > 2)
{
- foreach ($array2 as $key => $value)
+ foreach (array_slice(func_get_args(), 2) as $array2)
{
- if (array_key_exists($key, $array1))
+ foreach (array_intersect_key($array2, $array1) as $key => $value)
{
$array1[$key] = $value;
}