I have 2 json file each file contain 500 arrays. i need to merge 2 files in 1 file so the result will be 1000 arrays. I have found code from stackoverflow but its not working its just showing me the file 1 data.
<?php
$a = file_get_contents ("cache.json");
$b = file_get_contents ("cache2.json");
$r = [];
foreach(json_decode($a, true) as $key => $array){
$r[$key] = array_merge(json_decode($b, true)[$key],$array);
}
echo count($r);
?>
The json data look like this
$a = '[{"COLUMN_NAME":"ORDER_NO","COLUMN_TITLE":"Order Number"},{"COLUMN_NAME":"CUSTOMER_NO","COLUMN_TITLE":"Customer Number"}]';
$b = '[{"COLUMN_NAME":"ORDER_NO","DEFAULT_VALUE":"1521"},{"COLUMN_NAME":"CUSTOMER_NO","DEFAULT_VALUEE":"C1435"}]';