merge array to object php code example
Example 1: merge two objects in php
array_merge((array)json_decode($data1), (array) json_decode($data2));
Example 2: php combine arrays
$output = array_merge($array1, $array2);
array_merge((array)json_decode($data1), (array) json_decode($data2));
$output = array_merge($array1, $array2);