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
Probably not the best solution
$ids = array(1,2,3,4); $pairs = array(); foreach($ids as $key => $data){ foreach($ids as $subkey => $subdata){ if( $subkey != $key){ if(!in_array(array($subdata, $data) , $pairs) ){ $pairs[] = array($data, $subdata); } } } }
Anyway it works