什么是array_merge和阵列+阵列之间的区别? [英] What's the difference between array_merge and array + array?

查看:88
本文介绍了什么是array_merge和阵列+阵列之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个很简单的问题。有什么区别:

A fairly simple question. What's the difference between:

$merged = array_merge($array1, $array2);

$merged = $array1 + $array2;

推荐答案

的区别是:

+ 操作符取两个数组的工会,而 array_merge 函数接受工会的的重复键将被覆盖)。

The + operator takes the union of the two arrays, whereas the array_merge function takes the union BUT the duplicate keys are overwritten).

这篇关于什么是array_merge和阵列+阵列之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆