Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 要添加或要将两个新数组合并到3个以前的数组中吗_Php_Arrays_Codeigniter - Fatal编程技术网

Php 要添加或要将两个新数组合并到3个以前的数组中吗

Php 要添加或要将两个新数组合并到3个以前的数组中吗,php,arrays,codeigniter,Php,Arrays,Codeigniter,来自不同查询的另一个数组 array_1 = {"challenge_id":"1","user_id":"2","username":"abc","challenge_balance":"1million","bet":"lyf","challenge_name":"disaster","plan":"enjoy","challenge_type":"Me","c_type":"challenge"} array 2 = {"challenge_id":"8","user_id":"2","

来自不同查询的另一个数组

array_1 = {"challenge_id":"1","user_id":"2","username":"abc","challenge_balance":"1million","bet":"lyf","challenge_name":"disaster","plan":"enjoy","challenge_type":"Me","c_type":"challenge"}

array 2 = {"challenge_id":"8","user_id":"2","username":"abc","challenge_balance":"1million","bet":"lyf","challenge_name":"disaster","plan":"enjoy","challenge_type":"Me","c_type":"challenge"},

array_3 = {"challenge_id":"9","user_id":"2","username":"abc","challenge_balance":"1million","bet":"lyf","challenge_name":"disaster","plan":"enjoy","challenge_type":"Me","c_type":"challenge"}
我想结果应该在3个数组 这意味着第一个数组应该与两个数组中的第一个组合 第二个数组是两个数组中的第二个数组的组合 第三个数组是带有null的数组1。

只需将它们与

例如:

$merge_array = array_merge(first_array, second_array);
只需将它们与

例如:

$merge_array = array_merge(first_array, second_array);

ankit先生,结果我只得到一个数组,而我需要3个数组请不要打电话给先生,对于你的查询请使用foreach.brother,请你详细说明或告诉我使用codingankit先生,结果我只得到一个数组,而我需要3个数组请不要打电话给先生,对于你的查询请使用foreach.brother,请详细说明或告诉我如何使用编码
$one =  array('one'=>1, 'two'=>2);

$two =  array('three'=>1, 'four'=>2);

$three =  array('five'=>1, 'six'=>2);

$merge_array = array_merge($one, $two);


$merge_three = array_merge($merge_array, $three);

print_r($merge_three);

//THE result

Array ( [one] => 1 [two] => 2 [three] => 1 [four] => 2 [five] => 1 [six] => 2 )