首頁 >php教程 >php手册 >php 按列值合并数据,php合并数据

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

WBOY
WBOY原創
2016-06-13 09:07:55853瀏覽

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>



 

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn