3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __call($name, $args) { $method = $name.'_'.join('_', array_map('gettype', $args)); //ugly, but more common: //$method = $name.'_'.md5(serialize(array_map('gettype', $args))); if(method_exists($this, $method)) { return call_user_func_array([$this, $method], $args); } } protected function foo_integer_string($x, $y) { echo('Called method implementation with 1-st (int) and 2-nd (string) parameters'.PHP_EOL); } protected function foo_integer_integer($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
Called method implementation with 1-st (int) and 2-nd (string) parameters Called method implementation with 1-st (int) and 2-nd (int) parameters

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