3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IsolatedTest { protected $closure; public function __construct($closure) { $this->closure = $closure; } public function __invoke() { call_user_func($this->closure); } } class Test { public function testing(callable $what) { return Closure::bind($what, $this, $this); } } $test = new IsolatedTest(function () { echo 'This can be forked and called.'; }); $more = (new Test)->testing($test); var_dump($more);

preferences:
41.36 ms | 402 KiB | 5 Q