'; foreach ($arr as $row) { $count = 0; foreach ($row as $key => $col) { if ($count++) { echo str_repeat(' ', $spacing); } echo str_pad($col, $widths[$key]); } echo "\n"; } } $test_array = array( array('A', 'B', 'C', 'D', 'E'), array('a', 'b', 'c', 'd', 'e'), ); display_array($test_array, 3); ?>