Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. <?php
  2.  
  3. $player = " ";
  4. $goals = 0;
  5. $hasHattrick = false;
  6. $bestScore = PHP_INT_MIN;
  7. $bestPlayer = " ";
  8.  
  9.        
  10.  
  11. while ($player != "END") {
  12.     $player = readline();
  13.     $goals = intval(readline());
  14.     if ($goals >= 3){
  15.         $hasHattrick = true;
  16.     }
  17.     if ($goals > $bestScore){
  18.     $bestScore = $goals;
  19.     $bestPlayer = $player;
  20.     }
  21.     if ($goals >= 10) {
  22.     break;
  23.     }
  24.     $goals++;
  25.    
  26. }
  27. echo "$bestPlayer is the best player!". PHP_EOL;
  28.  
  29. if ($hasHattrick){
  30.     echo "He has scored $bestScore goals and made a hat-trick !!!";
  31. } else {
  32.     echo "He has scored $goals goals.";
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement