- var_dump: documentation ( source)
<?php
class Super
{
protected $child;
function setChild(Child $child){
$this->child = $child;
if($child->getSuper() !== $this)
$child->setSuper($this);
}
}
class Child
{
protected $super;
function setSuper(Super $super){
$this->super = $super;
$this->super->addChild($this);
}
function getSuper(){
return $this->super;
}
}
$super = new Super;
$child = new Child;
$super->setChild($child);
var_dump($super);
$super = new Super;
$child = new Child;
$child->setSuper($super);
var_dump($super);