mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-13 20:59:12 +08:00
Merge pull request #6759 from pana1990/helper-array-guide
Add syntax highlighting [skip ci]
This commit is contained in:
@@ -239,20 +239,22 @@ Encoding will use application charset and could be changed via third argument.
|
|||||||
|
|
||||||
## Merging Arrays <a name="merging-arrays"></a>
|
## Merging Arrays <a name="merging-arrays"></a>
|
||||||
|
|
||||||
|
```php
|
||||||
/**
|
/**
|
||||||
* Merges two or more arrays into one recursively.
|
* Merges two or more arrays into one recursively.
|
||||||
* If each array has an element with the same string key value, the latter
|
* If each array has an element with the same string key value, the latter
|
||||||
* will overwrite the former (different from array_merge_recursive).
|
* will overwrite the former (different from array_merge_recursive).
|
||||||
* Recursive merging will be conducted if both arrays have an element of array
|
* Recursive merging will be conducted if both arrays have an element of array
|
||||||
* type and are having the same key.
|
* type and are having the same key.
|
||||||
* For integer-keyed elements, the elements from the latter array will
|
* For integer-keyed elements, the elements from the latter array will
|
||||||
* be appended to the former array.
|
* be appended to the former array.
|
||||||
* @param array $a array to be merged to
|
* @param array $a array to be merged to
|
||||||
* @param array $b array to be merged from. You can specify additional
|
* @param array $b array to be merged from. You can specify additional
|
||||||
* arrays via third argument, fourth argument etc.
|
* arrays via third argument, fourth argument etc.
|
||||||
* @return array the merged array (the original arrays are not changed.)
|
* @return array the merged array (the original arrays are not changed.)
|
||||||
*/
|
*/
|
||||||
public static function merge($a, $b)
|
public static function merge($a, $b)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Converting Objects to Arrays <a name="converting-objects-to-arrays"></a>
|
## Converting Objects to Arrays <a name="converting-objects-to-arrays"></a>
|
||||||
|
|||||||
Reference in New Issue
Block a user