/ Published in: PHP
Dead salesman, BILLY MAYS, age(50) sold the following products:
- Awesome Auger
- Big City Slider
- Dash Tray
- Hercules Hook
- Mighty Mendit
Expand |
Embed | Plain Text
<?php class DeadObnoxiousInfomercialSalesman { protected $name = "Anonymous Salesman"; protected $age = "unknown"; public function name($name){ $this->name = $name; return $this; } public function age($age){ $this->age = $age; return $this; } public function sold($product){ $this->products[] = $product; return $this; } public function __toString(){ if($this->products){ " sold the following products:\n%s", ); } return $out; } } $person = new DeadObnoxiousInfomercialSalesman(); ->age(50) ->sold("Awesome Auger") ->sold("Big City Slider") ->sold("Dash Tray") ->sold("Hercules Hook") ->sold("Mighty Mendit"); ?>
You need to login to post a comment.
