srand ((float)microtime()*1000000); shuffle($data); for ($i=0; $i<count($data); $i+=2){ $name1 = $data[$i]; $name2 = $data[$i+1]; echo "$name1 vs. $name2<br>\n"; }