Guest User

Untitled

a guest
Jul 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2. class Goat {
  3. public $name = "";
  4. public function Goat($name) {
  5. $this->name = $name;
  6. }
  7. public function is_hungry_for($location) {
  8. if($location == 'Uncle Chens') return false;
  9. if($this->name == 'fulg0re' && $location == 'PCC') return false;
  10. if(date('G') > 12 && date('G') < 14 ) return true;
  11. return false;
  12. }
  13. }
  14.  
  15. $goats = array();
  16. $goats[] = new Goat("fulg0re");
  17. $goats[] = new Goat("ownpile");
  18. $goats[] = new Goat("beTTY");
  19. $goats[] = new Goat("d3");
  20.  
  21. $location = "Rudys";
  22. foreach($goats as $clown) {
  23. if($clown->is_hungry_for($location)) echo "{$clown->name} is hungry for $location\n";
  24. }
  25.  
  26. $location = "PCC";
  27. foreach($goats as $clown) {
  28. if($clown->is_hungry_for($location)) echo "{$clown->name} is hungry for $location\n";
  29. }
  30.  
  31. $location = "Uncle Chens";
  32. foreach($goats as $clown) {
  33. if($clown->is_hungry_for($location)) echo "{$clown->name} is hungry for $location\n";
  34. }
  35. ?>
Add Comment
Please, Sign In to add comment