Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/globals.php
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
* @see escape | * @see escape | ||||
*/ | */ | ||||
public static $escapeStrategy = self::ESCAPE_HTML; | public static $escapeStrategy = self::ESCAPE_HTML; | ||||
/** | /** | ||||
* Similar to array_merge_recursive but keyed-valued are always overwritten. | * Similar to array_merge_recursive but keyed-valued are always overwritten. | ||||
* Priority goes to the 2nd array. | * Priority goes to the 2nd array. | ||||
* | * | ||||
* @param $paArray1 array | * @param mixed $array1 Array 1. | ||||
* @param $paArray2 array | * @param mixed $array2 Array 2. | ||||
* | |||||
* @return array | * @return array | ||||
* @access public | |||||
*/ | */ | ||||
public static function array_merge_recursive($paArray1, $paArray2) | public static function array_merge_recursive($array1, $array2) | ||||
{ | { | ||||
if (!is_array($paArray1) or !is_array($paArray2)) { | if ( !is_array($array1) || !is_array($array2) ) { | ||||
return $paArray2; | return $array2; | ||||
} | } | ||||
foreach ($paArray2 AS $sKey2 => $sValue2) { | foreach ( $array2 as $array2_key => $array2_value ) { | ||||
$paArray1[$sKey2] = isset($paArray1[$sKey2]) ? self::array_merge_recursive($paArray1[$sKey2], $sValue2) : $sValue2; | if ( isset($array1[$array2_key]) ) { | ||||
$array1[$array2_key] = self::array_merge_recursive($array1[$array2_key], $array2_value); | |||||
} | |||||
else { | |||||
$array1[$array2_key] = $array2_value; | |||||
} | |||||
} | } | ||||
return $paArray1; | return $array1; | ||||
} | } | ||||
/** | /** | ||||
* Prepend a reference to an element to the beginning of an array. | * Prepend a reference to an element to the beginning of an array. | ||||
* Renumbers numeric keys, so $value is always inserted to $array[0] | * Renumbers numeric keys, so $value is always inserted to $array[0] | ||||
* | * | ||||
* @param $array array | * @param $array array | ||||
* @param $value mixed | * @param $value mixed | ||||
▲ Show 20 Lines • Show All 1025 Lines • Show Last 20 Lines |