3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public static function bar(array $ids) { return array_map(function($id) { return static::foo($id); }, $ids); } public static function foo($id) { return "halo {$id}"; } } class Test1 extends Test { public static function foo($id) { return "hi {$id}"; } } $className = Test1::class; //Let's say line above is input from user or some other code. $ids = [1, 2, 3, 4, 5]; print_r(call_user_func([$className, 'bar'], $ids));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => hi 1 [1] => hi 2 [2] => hi 3 [3] => hi 4 [4] => hi 5 )

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:
155.41 ms | 405 KiB | 5 Q