Say i start with a simple array (which could be theoretically of any length):
$ids = array(1,2,3,4);
What it the best solution for splitti
Sweet solution, Nev Stokes! I changed the 'while' statement to avoid the loop from breaking when one of the values is 0:
$ids = array(0, 1, 2, 3, 4); $out = array(); while ( !is_null( $item = array_shift($ids) ) ) { foreach ($ids as $key=>$value) { $out[] = array($item, $value); } }