Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Goat {
- public $name = "";
- public function Goat($name) {
- $this->name = $name;
- }
- public function is_hungry_for($location) {
- if($location == 'Uncle Chens') return false;
- if($this->name == 'fulg0re' && $location == 'PCC') return false;
- if(date('G') > 12 && date('G') < 14 ) return true;
- return false;
- }
- }
- $goats = array();
- $goats[] = new Goat("fulg0re");
- $goats[] = new Goat("ownpile");
- $goats[] = new Goat("beTTY");
- $goats[] = new Goat("d3");
- $location = "Rudys";
- foreach($goats as $clown) {
- if($clown->is_hungry_for($location)) echo "{$clown->name} is hungry for $location\n";
- }
- $location = "PCC";
- foreach($goats as $clown) {
- if($clown->is_hungry_for($location)) echo "{$clown->name} is hungry for $location\n";
- }
- $location = "Uncle Chens";
- foreach($goats as $clown) {
- if($clown->is_hungry_for($location)) echo "{$clown->name} is hungry for $location\n";
- }
- ?>
Add Comment
Please, Sign In to add comment