I am looking to do this a better way without the need to hardcode the integers for $justPrices[$i]
:
$pricesResult = array_merge($justPrices[0],
If you just want to flatten the array, you can use call_user_func_array to call array_merge
with the elements of $justPrices
as parameters:
$flat = call_user_func_array('array_merge', $justPrices);
This is equivalent to a the function call:
$flat = array_merge($justPrices[0], $justPrices[1], … , $justPrices[count($justPrices)-1]);