<?php
class Foo
{
public $oink = 'foo';
}
$foo = new Foo;
class Bar extends Foo
{
public function __construct()
{
var_dump(
get_object_vars($this),
get_class($this),
get_parent_class($this),
$r = new ReflectionProperty($this, 'oink'),
$r->getValue($this),
$p = new ReflectionProperty(get_parent_class($this), 'oink'),
$p->getValue($this)
);
unset($this->oink);
var_dump(
get_object_vars($this),
get_class($this),
get_parent_class($this),
$r = new ReflectionProperty($this, 'oink'),
$r->getValue($this),
$p = new ReflectionProperty(get_parent_class($this), 'oink'),
$p->getValue($this)
);
$this->oink = 'bar';
var_dump(
get_object_vars($this),
get_class($this),
get_parent_class($this),
$r = new ReflectionProperty($this, 'oink'),
$r->getValue($this),
$p = new ReflectionProperty(get_parent_class($this), 'oink'),
$p->getValue($this)
);
}
}
$bar = new Bar;
preferences:
40.17 ms | 402 KiB | 5 Q