Home  >  Article  >  php教程  >  php 按列值合并数据,php合并数据

php 按列值合并数据,php合并数据

WBOY
WBOYOriginal
2016-06-13 09:07:55839browse

php 按列值合并数据,php合并数据



    <span>/*</span><span>
     * PHP按值合并数组
     * </span><span>*/</span>
    <span>function</span> my_array_merge(&<span>$array1</span>, &<span>$array2</span><span>) {
        </span><span>$result</span> = <span>Array</span><span>();
        </span><span>foreach</span>(<span>$array1</span> <span>as</span> <span>$key</span> => &<span>$value</span><span>) {
            </span><span>$result</span>[<span>$key</span>] = <span>array_merge</span>(<span>$value</span>, <span>$array2</span>[<span>$key</span><span>]);
        }
        </span><span>return</span> <span>$result</span><span>;
    }</span>



 

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