fork download
  1. <?php
  2.  
  3. abstract class A
  4. {
  5. }
  6. class B extends A
  7. {
  8.  
  9. }
  10. class C
  11. {
  12. public $x;
  13.  
  14. public function __construct(A $b)
  15. {
  16. $this->x = $b;
  17. var_dump($this->x);
  18. }
  19. }
  20.  
  21. $b = new B();
  22. $c = new C($b);
Success #stdin #stdout 0.02s 52480KB
stdin
Standard input is empty
stdout
object(B)#1 (0) {
}