3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foobar { public function call($method = 'dump', $parameters) { if (in_array($method, ['foo', 'bar'])) { return $this->$method($parameters); } return $this->$method($parameters); } public function dump(...$params) { return var_dump($params); } public function foo(...$params) { return 'foo ' . in_array('foobar', $params); } public function bar(...$params) { return 'bar ' . in_array('barfoo', $params); } } $foobar = new Foobar; echo $foobar->call('foobar', 'test', 'hello');
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Optional parameter $method declared before required parameter $parameters is implicitly treated as a required parameter in /in/FESZd on line 5 Fatal error: Uncaught Error: Call to undefined method Foobar::foobar() in /in/FESZd:12 Stack trace: #0 /in/FESZd(32): Foobar->call('foobar', 'test', 'hello') #1 {main} thrown in /in/FESZd on line 12
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:
49.69 ms | 401 KiB | 8 Q