PHP数组合并成一个大阵 [英] PHP combine arrays into one big array

查看:99
本文介绍了PHP数组合并成一个大阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能数组他们这样的组合,基本上追加到一个大数组:

Is it possible to combine arrays, and basically append them to one big array like this:

$a = array(1,2,3,4);
$b = array(5,6,7,8);
$c = array(1,2,3,4);

,使得输出将是:结果

so that the output would be:

$result = array(1,2,3,4,5,6,7,8,1,2,3,4);

这可能吗?

感谢您的帮助!

推荐答案

HTTP: //php.net/manual/en/function.array-merge.php

$a = array(1,2,3,4);
$b = array(5,6,7,8);
$c = array(1,2,3,4);

$out = array_merge($a, $b, $c);

结果:

Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
    [4] => 5
    [5] => 6
    [6] => 7
    [7] => 8
    [8] => 1
    [9] => 2
    [10] => 3
    [11] => 4
)

这篇关于PHP数组合并成一个大阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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