Advertisement
Guest User

team_shuffle

a guest
Oct 14th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. <?php
  2.  
  3. srand();
  4.  
  5. $fc[0] = "zenit";
  6. $fc[1] = "barcelona";
  7. $fc[2] = "milan";
  8. $fc[3] = "dortmund";
  9. $fc[4] = "real madrid";
  10. $fc[5] = "Juventus";
  11. $fc[6] = "totenhem";
  12. $fc[7] = "manchester united";
  13. $fc[8] = "manchester citi";
  14. $fc[9] = "lokomotiv";
  15. $fc[10] = "CSKA";
  16. $fc[11] = "Chelsea";
  17. $fc[12] = "Inter";
  18. $fc[13] = "Dinamo";
  19. $fc[14] = "Bauren";
  20. $fc[15] = "Arsenal";
  21. $fc[16] = "Valencia";
  22. $fc[17] = "Monako";
  23. $fc[18] = "Inter milan";
  24. $fc[19] = "New castle";
  25.  
  26. function names($commands) {
  27.     $used = Array();
  28.   for($i = 0; $i != count($commands) / 2; $i++) {
  29.         do { $tmp1 = rand(0, count($commands) - 1); } while(in_array($tmp1, $used));
  30.         $used[] = $tmp1;
  31.         do { $tmp2 = rand(0, count($commands) - 1); } while(in_array($tmp2, $used));
  32.         $used[] = $tmp2;
  33.         echo $commands[$tmp1] . " VS " . $commands[$tmp2] . "<br/>";
  34.   }
  35. }
  36.  
  37. names($fc);
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement