Just wondering if anyone has transformed a 2 dim array to a one dim array in php. I\'ve yet to come across a clear explanation in php. Any suggestion would be appreciated.>
Try this:
function array_2d_to_1d ($input_array) { $output_array = array(); for ($i = 0; $i < count($input_array); $i++) { for ($j = 0; $j < count($input_array[$i]); $j++) { $output_array[] = $input_array[$i][$j]; } } return $output_array; }