<?php $arr = [ [ 'foo 1', 'bar 1', '', '', 'test 1', 'lorem 1', 'ipsum 1', '', 'will be ignored 1', ], [ 'foo 2', 'bar 2', '', '', 'test 2', 'lorem 2', 'ipsum 2', '', 'will be ignored 2', ], [ 'foo 3', 'bar 3', '', '', 'test 3', 'lorem 3', 'ipsum 3', '', 'will be ignored 3', ], [ 'foo 4', 'bar 4', '', '', 'test 4', 'lorem 4', 'ipsum 4', '', 'will be ignored 4', ], ]; $newArray = []; foreach($arr as $sub) { // The example array you say you want have 8 elements, indexes 0-7 $newArray[] = array_slice($sub, 0, 8); } print_r($newArray);
You have javascript disabled. You will not be able to edit any code.