我有两个数组,新数组锁定在旧数组复制钥匙,更换与新数组值值,合并两个数组,找到重复键和更新值
旧阵列
Array
(
[tool_situs] => Array
(
[template] => aa
[title] => bb
)
[style] => Array
(
[.title] => Array
(
[color] => red
[font-size] => 20px
)
)
)
和新阵列
Array
(
[tool_situs] => Array
(
[title] => ddd
)
[style] => Array
(
[.title] => Array
(
[color] => #fff
)
)
)
我已经使用array_merge_recursive()
但不能代替重复键的值尝试,仅从新阵列
Array
(
[tool_situs] => Array
(
[template] => aa
[title] => Array
(
[0] => aa
[1] => ddd
)
)
[style] => Array
(
[.title] => Array
(
[color] => Array
(
[0] => red
[1] => #fff
)
[font-size] => 20px
)
)
)
在阵列ebove
,tool_situs->标题仅从新阵列添加新的阵列,也风格 - >标题 - >颜色回报由NE阵列添加新的价值。
帮我tool_situs->标题和风格都值如何 - >标题 - >颜色更换新阵列的价值这样
我会出来把这样的:
Array
(
[tool_situs] => Array
(
[template] =>aa
[title] => ddd
)
[style] => Array
(
[.title] => Array
(
[color] => #fff
[font-size] => 20px
)
)
)
*我已尝试使用* ...?试图使用什么? – Rizier123
欢迎来到SO。 请阅读[我可以问哪些主题](http://stackoverflow.com/help/on-topic) 和[如何提出一个好问题](http://stackoverflow.com/help/how-to - 问) 和[完美的问题](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/) SO是**不是免费的编码或教程服务* *你必须表明你已经努力解决你自己的问题。 – RiggsFolly
@ TSaddamFahmiMicely check [array_replace_recursive](http://php.net/manual/en/function.array-replace-recursive.php) – jitendrapurohit