3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyParent { protected $x = "parent"; public function __construct() { $this->x = "parent - construct"; } } class MyChild extends MyParent { protected $x = "child"; public function __construct() { var_dump($this->x); $this->x = "child - construct"; var_dump($this->x); $closure = function () { var_dump($this->x); }; $closure = $closure->bindTo($this, parent::class); $closure(); } } new MyChild;

preferences:
23.02 ms | 404 KiB | 5 Q