helpers\BaseArrayHelper merge()

merge() public static method

Merges two or more arrays into one recursively.

If each array has an element with the same string key value, the latter will overwrite the former (different from array_merge_recursive). Recursive merging will be conducted if both arrays have an element of array type and are having the same key. For integer-keyed elements, the elements from the latter array will be appended to the former array. You can use yii\helpers\UnsetArrayValue object to unset value from previous array or yii\helpers\ReplaceArrayValue to force replace former value instead of recursive merging.

public static array merge ( $a, $b )
$a array

Array to be merged to

$b array

Array to be merged from. You can specify additional arrays via third argument, fourth argument etc.

return array

The merged array (the original arrays are not changed.)

doc_Yii
2016-10-30 17:04:28
Comments
Leave a Comment

Please login to continue.