3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { public $hi; public function hi($hi) { $this->hi = $hi; } } class A { protected function foo($name, Closure $t) { $x = new X(); echo $name; echo "\n"; $t($x); print_r($x); } } class B extends A { public function __construct() { $this->foo('users', function($t) { $t->hi('hello!'); }); } } new B();

preferences:
34.33 ms | 402 KiB | 5 Q