3v4l.org

run code in 300+ PHP versions simultaneously
<?php $func = function(array $a, $b){ echo implode(' ', func_get_args()); }; $closure = &$func; $reflection = new ReflectionFunction($closure); $arguments = $reflection->getParameters(); if($arguments && $arguments[0]->isArray()){ echo 'Giving array. Result: '; call_user_func($closure, ['a' => 5, 'b' => 10]); } else { echo 'Giving individuals. Result: '; call_user_func($closure, 5, 10); }
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Method ReflectionParameter::isArray() is deprecated in /in/WGmZZ on line 9 Giving array. Result: Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed in /in/WGmZZ on line 11 and exactly 2 expected in /in/WGmZZ:3 Stack trace: #0 /in/WGmZZ(11): {closure}(Array) #1 {main} thrown in /in/WGmZZ on line 3
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:
54.39 ms | 402 KiB | 8 Q