PHP array_merge_recursive()函数与示例
PHP array_merge_recursive()函数 (PHP array_merge_recursive() function)
array_merge_recursive() function is used to merge two or more arrays, it returns a new array with merged elements. The only difference between array_merge() and array_merge_recursive() function is: "It merges the values having the same key as an array instead of overriding the values."
array_merge_recursive()函数用于合并两个或多个数组,它返回一个具有合并元素的新数组。 “ array_merge()和array_merge_recursive()函数之间的唯一区别是: “它合并与数组具有相同键的值,而不是覆盖这些值。”
Syntax:
句法:
array_merge_recursive(array1, array2,...);
It accepts two or more arrays and returns a new array with merged elements.
它接受两个或多个数组,并返回带有合并元素的新数组。
Examples:
例子:
Input:
$arr1 = array("a" => "Hello", "b" => "Hi");
$arr2 = array("a" => "Okay!", "d" => "Nothing");
Output:
Array
(
[a] => Array
(
[0] => Hello
[1] => Okay!
)
[b] => Hi
[d] => Nothing
)
PHP code:
PHP代码:
<?php
$arr1 = array("a" => "Hello", "b" => "Hi");
$arr2 = array("a" => "Okay!", "d" => "Nothing");
//merging arrays
$arr3 = array_merge_recursive($arr1, $arr2);
//printing
print_r ($arr3);
?>
Output
输出量
Array
(
[a] => Array
(
[0] => Hello
[1] => Okay!
)
[b] => Hi
[d] => Nothing
)
翻译自: https://www.includehelp.com/php/array_merge_recursive-function-with-example.aspx
PHP array_merge_recursive()函数与示例相关推荐
- php指定长度 分割整形,php指定长度分割字符串str_split函数用法示例
本文实例讲述了php指定长度分割字符串str_split函数用法.分享给大家供大家参考,具体如下: 示例1:$str = 'abcdefgh'; $arr = str_split($str,2); 运 ...
- getdate函数_PHP getdate()函数与示例
getdate函数 PHP getdate()函数 (PHP getdate() function) getdate() function is used to get the local date/ ...
- 安卓log.e函数打印示例_log1p()函数以及C ++中的示例
安卓log.e函数打印示例 C ++ log1p()函数 (C++ log1p() function) log1p() function is a library function of cmath ...
- gettimeofday_PHP gettimeofday()函数与示例
gettimeofday PHP gettimeofday()函数 (PHP gettimeofday() function) gettimeofday() function is used to g ...
- dir函数_PHP dir()函数与示例
dir函数 PHP dir()函数 (PHP dir() function) dir() function is an instance of the directory class, it is u ...
- PHP rewinddir()函数与示例
PHP rewinddir()函数 (PHP rewinddir() function) rewinddir() function is used to rewind/reset the direct ...
- stl swap函数_C ++ STL | vector :: swap()函数与示例
stl swap函数 C ++ STL vector :: swap()函数 (C++ STL vector::swap() function) vector::swap() function is ...
- C#回调函数应用示例,形象比喻方法助理解
C#回调函数应用示例,形象比喻方法助理解,整理了一个简单的例子来说明回调函数的用法: namespace CallBackFunction { class Program { ...
- php解escape,PHP下escape解码函数用法示例
这篇文章主要为大家详细介绍了PHP下escape解码函数用法示例,具有一定的参考价值,可以用来参考一下. 感兴趣的小伙伴,下面一起跟随512笔记的小编小韵来看看吧!GB2312编码: 代码如下: fu ...
最新文章
- 【MongoDB异常】Exception authenticating MongoCredential解决方法
- TiKV 成功晋级 CNCF 孵化项目
- 恒安嘉新面试题java_【恒安嘉新面试|面试题】-看准网
- IGMP Internet组管理协议 未完
- 内核地址空间和用户地址空间
- 前端构建工具gulpjs的使用介绍及技巧 (转)
- 在Ubuntu上为Android系统编写Linux内核驱动程序
- sqlserver evaluation是什么版本_使用SSMS扫描和查找SQL Server数据库的潜在安全漏洞...
- [转]GridView 72般绝技
- 最短路径问题:Dijkstra算法详解
- Linux logo和屏幕光标
- curl之采集QQ空间留言
- Android Broadcast Receiver 与Activity() (android 开发的四大组件)
- HTML和CSS面试题第35题
- 国内外卫星数据查询地址
- firefox火狐浏览器显示多列书签菜单
- Node.js meitulu图片批量下载爬虫1.03版
- statsmodels.stats.proportion.proportions_ztest
- Vue脚手架热更新技术探秘
- matlab中参数估计,关于matlab的参数估计