fork download
  1. <?php
  2.  
  3. class A
  4. {
  5. private $x;
  6.  
  7. public function __construct($x)
  8. {
  9. $this->x = $x;
  10. }
  11. public function m($other)
  12. {
  13. echo $other->x;
  14. }
  15. }
  16.  
  17. $foo = new A(1);
  18. $bar = new A(2);
  19. $foo->m($bar);
  20.  
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
2