- var_dump: documentation ( source)
<?php
class A {
protected $thing;
public function __construct($thing) {
$this->thing = $thing;
}
public static function create() {
return new static('foo');
}
}
class B extends A {
protected $another;
public function getAnother() {
return $this->another;
}
public static function create() {
$instance = parent::create();
$instance->another = 'bar';
return $instance;
}
}
var_dump(B::create()->getAnother());