3v4l.org

run code in 500+ PHP versions simultaneously
<?php class x { /* function foo() { echo __METHOD__.PHP_EOL; } */ } $object = new x(); $method = 'foo'; $callable = [$object, $method]; //$callable(1); // Call to undefined method stdClass::foo() // No check until execution $closure = fn (...$args) => $object->$method(...$args); //$closure(1); // Call to undefined method stdClass::foo() //Call to undefined method stdClass::foo() $closure = [$object, $method](...); //Failed to create closure from callable: class stdClass does not have a method "foo" Closure::fromCallable([$object, $method]);
Output for git.master_jit, git.master
Fatal error: Uncaught Error: Call to undefined method x::foo() in /in/tRUT3:22 Stack trace: #0 {main} thrown in /in/tRUT3 on line 22
Process exited with code 255.

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:
57.52 ms | 867 KiB | 4 Q