У меня есть около 850 файлов json, и я хотел бы объединить их в группы по 50. Какой был бы лучший способ для этого?Несколько внешних файлов JSON для объединения
array_merge?
Я видел несколько примеров, но не более двух массивов.
<?
$array1 = json_decode(file_get_contents('1.json'));
$array2 = json_decode(file_get_contents('2.json'));
$array3 = json_decode(file_get_contents('3.json'));
$array4 = json_decode(file_get_contents('4.json'));
$array5 = json_decode(file_get_contents('5.json'));
$array6 = json_decode(file_get_contents('6.json'));
$array7 = json_decode(file_get_contents('7.json'));
$array8 = json_decode(file_get_contents('8.json'));
$array9 = json_decode(file_get_contents('9.json'));
$array10 = json_decode(file_get_contents('10.json'));
$array11 = json_decode(file_get_contents('11.json'));
$array12 = json_decode(file_get_contents('12.json'));
$array13 = json_decode(file_get_contents('13.json'));
$array14 = json_decode(file_get_contents('14.json'));
$array15 = json_decode(file_get_contents('15.json'));
$result = array_merge($array14, $array15);
var_dump(json_encode($result));
?>
Пример 1 из JSON: http://pastebin.com/QDyGGjQj
обнадеживающего Результата (3 из 50, так как 50 огромно примера): http://pastebin.com/fP2MHN2Y
вы можете дать п номер массива в качестве параметра в 'array_merge' функции –