3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static function bar(string $label): void { echo "Callable called: $label\n"; } } class MyClass { private static string $myCallable; public function myFunc(): void { static::$myCallable = \Foo::class . '::bar'; (self::$myCallable)('this also works'); } } $myCallable = \Foo::class . '::bar'; $myCallable('calling this works!'); (new MyClass)->myFunc();
Output for git.master_jit, git.master
Callable called: calling this works! Callable called: this also works

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
27.97 ms | 405 KiB | 5 Q