3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __invoke($a, $b) { echo "$a - $b\n"; } } class Bar { public $f; public function __construct() { $this->f = new Foo; } } $b = new Bar; $f = $b->f; $f('hello', 'world'); call_user_func($b->f, 'hello', 'world'); // i assume php assumes that f is a method here, // so this fails! Bar::f() does not exist... // $b->f('hello', 'world'); // php simply cannot parse this for whatever // reason. seems like it shoudl be able to. :) // ($b->f)('hello', 'world');
Output for git.master, git.master_jit, rfc.property-hooks
hello - world hello - world

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:
39.67 ms | 401 KiB | 8 Q