$i = 0; foreach($a as $key =>$one){ $i++; if($i >3) break; printf("%s - %s ",$key,$one); echo "\n"; }