3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(Closure $callback): void { $toto = call_user_func($callback); } $fake = new class { public $called = false; public function __invoke() { $this->called = true; } }; var_dump($fake); test(Closure::fromCallable($fake)); var_dump($fake);

preferences:
33.58 ms | 404 KiB | 5 Q