- var_dump: documentation ( source)
<?php
class A {
}
class B extends A {
public self $instOfSelf;
public parent $instOfParent;
}
$b = new B();
$b->instOfParent = new B(); # Allowed
var_dump($b);
$b->instOfParent = new A(); # Also allowed
var_dump($b);
$b->instOfSelf = new B(); # Allowed
var_dump($b);
$b->instOfSelf = new A(); # ERROR
var_dump($b);