fork(1) download
  1. <?php
  2.  
  3. interface UserInterface {
  4. function getName();
  5. }
  6.  
  7. class UserClass implements UserInterface {
  8. function getName() {
  9. return "Вася";
  10. }
  11. };
  12.  
  13.  
  14. function printName (UserInterface $user) {
  15. echo $user->getName();
  16. }
  17.  
  18. $u = new UserClass;
  19.  
  20. printName ($u);
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
Вася