Guest User

Untitled

a guest
Jun 13th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. <?php
  2.  
  3. interface Talker
  4. {
  5. public function talk();
  6. }
  7.  
  8. class HelloTalker implements Talker
  9. {
  10. private $_listener;
  11.  
  12. public function __construct($listener)
  13. {
  14. $this->_listener = $listener;
  15. }
  16.  
  17. public function talk()
  18. {
  19. return sprintf('Hello %s!', $this->_listener);
  20. }
  21. }
  22.  
  23. $hello = new HelloTalker('World');
  24.  
  25. echo $hello->talk();
Add Comment
Please, Sign In to add comment