3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __call($name, $args) { $hash = join('_', array_map('gettype')); if(method_exists($this, $name.$hash)) { return call_user_func_array([$this, $name.$hash], $args); } } protected function foo_int_string($x, $y) { echo('Called method implementation with 1-st (int) and 2-nd (string) parameters'.PHP_EOL); } protected function foo_int_int($x, $y) { echo('Called method implementation with 1-st (int) and 2-nd (int) parameters'.PHP_EOL); } } $obj=new Test(); $obj->foo(5, "bar"); $obj->foo(8, 2);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: array_map() expects at least 2 arguments, 1 given in /in/2GCp4:6 Stack trace: #0 /in/2GCp4(6): array_map('gettype') #1 /in/2GCp4(25): Test->__call('foo', Array) #2 {main} thrown in /in/2GCp4 on line 6
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:
42.45 ms | 401 KiB | 8 Q