3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $function = new ReflectionFunction(function( $a0, &$a1, array $a2, array &$a3, Type $a4, Type &$a5, Namespaced\Type $a6, Namespaced\Type &$a7, $a8 = 'string', &$a9 = 111, array $a10 = array('a', 'b', 'c' => 'd'), array &$a11 = null, Type $a12 = null, Type &$a13 = null, Namespaced\Type $a14 = null, Namespaced\Type &$a15 = null ){}); $parameters = $function->getParameters(); var_dump(array_map('strval', $parameters)); $function = new ReflectionFunction(function( $a0 = ReflectionMethod::IS_FINAL ){}); $parameters = $function->getParameters(); var_dump(array_map('strval', $parameters)); $function = new ReflectionFunction(function( callable $a0, callable $a1 = null ){}); $parameters = $function->getParameters(); var_dump(array_map('strval', $parameters));
based on L4duP
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
array(16) { [0]=> string(31) "Parameter #0 [ <required> $a0 ]" [1]=> string(32) "Parameter #1 [ <required> &$a1 ]" [2]=> string(37) "Parameter #2 [ <required> array $a2 ]" [3]=> string(38) "Parameter #3 [ <required> array &$a3 ]" [4]=> string(36) "Parameter #4 [ <required> Type $a4 ]" [5]=> string(37) "Parameter #5 [ <required> Type &$a5 ]" [6]=> string(47) "Parameter #6 [ <required> Namespaced\Type $a6 ]" [7]=> string(48) "Parameter #7 [ <required> Namespaced\Type &$a7 ]" [8]=> string(42) "Parameter #8 [ <optional> $a8 = 'string' ]" [9]=> string(38) "Parameter #9 [ <optional> &$a9 = 111 ]" [10]=> string(47) "Parameter #10 [ <optional> array $a10 = Array ]" [11]=> string(55) "Parameter #11 [ <optional> array or NULL &$a11 = NULL ]" [12]=> string(53) "Parameter #12 [ <optional> Type or NULL $a12 = NULL ]" [13]=> string(54) "Parameter #13 [ <optional> Type or NULL &$a13 = NULL ]" [14]=> string(64) "Parameter #14 [ <optional> Namespaced\Type or NULL $a14 = NULL ]" [15]=> string(65) "Parameter #15 [ <optional> Namespaced\Type or NULL &$a15 = NULL ]" } array(1) { [0]=> string(35) "Parameter #0 [ <optional> $a0 = 4 ]" } array(2) { [0]=> string(40) "Parameter #0 [ <required> callable $a0 ]" [1]=> string(55) "Parameter #1 [ <optional> callable or NULL $a1 = NULL ]" }
Output for hhvm-3.10.0 - 3.12.0
array(16) { [0]=> string(31) "Parameter #0 [ <required> $a0 ]" [1]=> string(32) "Parameter #1 [ <required> &$a1 ]" [2]=> string(37) "Parameter #2 [ <required> array $a2 ]" [3]=> string(38) "Parameter #3 [ <required> array &$a3 ]" [4]=> string(36) "Parameter #4 [ <required> Type $a4 ]" [5]=> string(37) "Parameter #5 [ <required> Type &$a5 ]" [6]=> string(47) "Parameter #6 [ <required> Namespaced\Type $a6 ]" [7]=> string(48) "Parameter #7 [ <required> Namespaced\Type &$a7 ]" [8]=> string(42) "Parameter #8 [ <optional> $a8 = 'string' ]" [9]=> string(38) "Parameter #9 [ <optional> &$a9 = 111 ]" [10]=> string(89) "Parameter #10 [ <optional> array $a10 = array ( 0 => 'a', 1 => 'b', 'c' => 'd', ) ]" [11]=> string(55) "Parameter #11 [ <optional> array or NULL &$a11 = NULL ]" [12]=> string(53) "Parameter #12 [ <optional> Type or NULL $a12 = NULL ]" [13]=> string(54) "Parameter #13 [ <optional> Type or NULL &$a13 = NULL ]" [14]=> string(64) "Parameter #14 [ <optional> Namespaced\Type or NULL $a14 = NULL ]" [15]=> string(65) "Parameter #15 [ <optional> Namespaced\Type or NULL &$a15 = NULL ]" } array(1) { [0]=> string(35) "Parameter #0 [ <optional> $a0 = 4 ]" } array(2) { [0]=> string(40) "Parameter #0 [ <required> callable $a0 ]" [1]=> string(55) "Parameter #1 [ <optional> callable or NULL $a1 = NULL ]" }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/boXI1 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/boXI1 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/boXI1 on line 3
Process exited with code 255.