Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $player = " ";
- $goals = 0;
- $hasHattrick = false;
- $bestScore = PHP_INT_MIN;
- $bestPlayer = " ";
- while ($player != "END") {
- $player = readline();
- $goals = intval(readline());
- if ($goals >= 3){
- $hasHattrick = true;
- }
- if ($goals > $bestScore){
- $bestScore = $goals;
- $bestPlayer = $player;
- }
- if ($goals >= 10) {
- break;
- }
- $goals++;
- }
- echo "$bestPlayer is the best player!". PHP_EOL;
- if ($hasHattrick){
- echo "He has scored $bestScore goals and made a hat-trick !!!";
- } else {
- echo "He has scored $goals goals.";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement