Home >Backend Development >PHP Tutorial > array_merge掉失空数组,该如何解决

array_merge掉失空数组,该如何解决

WBOY
WBOYOriginal
2016-06-13 13:00:581080browse

array_merge掉失空数组
array_merge掉失空数组

怎么保留全面初始化模板数组的所有数据?

------解决方案--------------------
print_r(array_merge_recursive($a, $b));

Array
(
    [color_and_size] => Array
        (
            [colors] => Array
                (
                    [0] => 2001
                    [1] => 2002
                )

            [sizes] => Array
                (
                )

        )

)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn