Skip to content

Instantly share code, notes, and snippets.

@o-shabashov
Created May 29, 2016 22:52
Show Gist options
  • Save o-shabashov/840add2b7aa6ad6e53700998c9167ae1 to your computer and use it in GitHub Desktop.
Save o-shabashov/840add2b7aa6ad6e53700998c9167ae1 to your computer and use it in GitHub Desktop.
Arrays '+' VS Yii2 ArrayHelper::merge
<?php
// $arr1
Array
(
[a] => 1
[b] => 2
[c] => 3
)
// $arr2
Array
(
[a] => 11
[b] =>
[c] => 3
[d] => 4
)
// $arr1 + $arr2
Array
(
[a] => 1
[b] => 2
[c] => 3
[d] => 4
)
// ArrayHelper::merge($arr1, $arr2)
Array
(
[a] => 11
[b] =>
[c] => 3
[d] => 4
)
// ArrayHelper::merge($arr2, $arr1)
Array
(
[a] => 1
[b] => 2
[c] => 3
[d] => 4
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment