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, $a0 = 'string', &$a1 = 111, array $a2 = array('a', 'b', 'c' => 'd'), array &$a3 = null, Type $a4 = null, Type &$a5 = null, Namespaced\Type $a6 = null, Namespaced\Type &$a7 = null ){}); $parameters = $function->getParameters(); var_dump(array_map('strval', $parameters)); var_dump(array_map(function($parameter){return $parameter->getName();}, $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 t1t9e
Output for 5.3.6 - 5.6.28
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> $a0 = 'string' ]" [9]=> string(38) "Parameter #9 [ <optional> &$a1 = 111 ]" [10]=> string(46) "Parameter #10 [ <optional> array $a2 = Array ]" [11]=> string(54) "Parameter #11 [ <optional> array or NULL &$a3 = NULL ]" [12]=> string(52) "Parameter #12 [ <optional> Type or NULL $a4 = NULL ]" [13]=> string(53) "Parameter #13 [ <optional> Type or NULL &$a5 = NULL ]" [14]=> string(63) "Parameter #14 [ <optional> Namespaced\Type or NULL $a6 = NULL ]" [15]=> string(64) "Parameter #15 [ <optional> Namespaced\Type or NULL &$a7 = NULL ]" } array(16) { [0]=> string(2) "a0" [1]=> string(2) "a1" [2]=> string(2) "a2" [3]=> string(2) "a3" [4]=> string(2) "a4" [5]=> string(2) "a5" [6]=> string(2) "a6" [7]=> string(2) "a7" [8]=> string(2) "a0" [9]=> string(2) "a1" [10]=> string(2) "a2" [11]=> string(2) "a3" [12]=> string(2) "a4" [13]=> string(2) "a5" [14]=> string(2) "a6" [15]=> string(2) "a7" } 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 5.3.5
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(40) "Parameter #8 [ <optional> $ = 'string' ]" [9]=> string(36) "Parameter #9 [ <optional> &$ = 111 ]" [10]=> string(46) "Parameter #10 [ <optional> array $`: = Array ]" [11]=> string(54) "Parameter #11 [ <optional> array or NULL &$h< = NULL ]" [12]=> string(52) "Parameter #12 [ <optional> Type or NULL $�> = NULL ]" [13]=> string(53) "Parameter #13 [ <optional> Type or NULL &$�@ = NULL ]" [14]=> string(63) "Parameter #14 [ <optional> Namespaced\Type or NULL $pC = NULL ]" [15]=> string(64) "Parameter #15 [ <optional> Namespaced\Type or NULL &$0A = NULL ]" } array(16) { [0]=> string(2) "a0" [1]=> string(2) "a1" [2]=> string(2) "a2" [3]=> string(2) "a3" [4]=> string(2) "a4" [5]=> string(2) "a5" [6]=> string(2) "a6" [7]=> string(2) "a7" [8]=> string(2) "" [9]=> string(2) "" [10]=> string(2) "`:" [11]=> string(2) "h<" [12]=> string(2) "�>" [13]=> string(2) "�@" [14]=> string(2) "pC" [15]=> string(2) "0A" } 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 5.3.4
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(40) "Parameter #8 [ <optional> $ = 'string' ]" [9]=> string(36) "Parameter #9 [ <optional> &$ = 111 ]" [10]=> string(46) "Parameter #10 [ <optional> array $`z = Array ]" [11]=> string(54) "Parameter #11 [ <optional> array or NULL &$h| = NULL ]" [12]=> string(52) "Parameter #12 [ <optional> Type or NULL $�~ = NULL ]" [13]=> string(53) "Parameter #13 [ <optional> Type or NULL &$� = NULL ]" [14]=> string(63) "Parameter #14 [ <optional> Namespaced\Type or NULL $p� = NULL ]" [15]=> string(64) "Parameter #15 [ <optional> Namespaced\Type or NULL &$0� = NULL ]" } array(16) { [0]=> string(2) "a0" [1]=> string(2) "a1" [2]=> string(2) "a2" [3]=> string(2) "a3" [4]=> string(2) "a4" [5]=> string(2) "a5" [6]=> string(2) "a6" [7]=> string(2) "a7" [8]=> string(2) "" [9]=> string(2) "" [10]=> string(2) "`z" [11]=> string(2) "h|" [12]=> string(2) "�~" [13]=> string(2) "�" [14]=> string(2) "p�" [15]=> string(2) "0�" } 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 5.3.3
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(40) "Parameter #8 [ <optional> $ = 'string' ]" [9]=> string(36) "Parameter #9 [ <optional> &$ = 111 ]" [10]=> string(46) "Parameter #10 [ <optional> array $ 5 = Array ]" [11]=> string(54) "Parameter #11 [ <optional> array or NULL &$(7 = NULL ]" [12]=> string(52) "Parameter #12 [ <optional> Type or NULL $X9 = NULL ]" [13]=> string(53) "Parameter #13 [ <optional> Type or NULL &$�; = NULL ]" [14]=> string(63) "Parameter #14 [ <optional> Namespaced\Type or NULL $0> = NULL ]" [15]=> string(64) "Parameter #15 [ <optional> Namespaced\Type or NULL &$�; = NULL ]" } array(16) { [0]=> string(2) "a0" [1]=> string(2) "a1" [2]=> string(2) "a2" [3]=> string(2) "a3" [4]=> string(2) "a4" [5]=> string(2) "a5" [6]=> string(2) "a6" [7]=> string(2) "a7" [8]=> string(2) "" [9]=> string(2) "" [10]=> string(2) " 5" [11]=> string(2) "(7" [12]=> string(2) "X9" [13]=> string(2) "�;" [14]=> string(2) "0>" [15]=> string(2) "�;" } 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 5.3.2
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(40) "Parameter #8 [ <optional> $ = 'string' ]" [9]=> string(36) "Parameter #9 [ <optional> &$ = 111 ]" [10]=> string(46) "Parameter #10 [ <optional> array $�( = Array ]" [11]=> string(54) "Parameter #11 [ <optional> array or NULL &$�* = NULL ]" [12]=> string(52) "Parameter #12 [ <optional> Type or NULL $- = NULL ]" [13]=> string(53) "Parameter #13 [ <optional> Type or NULL &$`/ = NULL ]" [14]=> string(63) "Parameter #14 [ <optional> Namespaced\Type or NULL $�1 = NULL ]" [15]=> string(64) "Parameter #15 [ <optional> Namespaced\Type or NULL &$�/ = NULL ]" } array(16) { [0]=> string(2) "a0" [1]=> string(2) "a1" [2]=> string(2) "a2" [3]=> string(2) "a3" [4]=> string(2) "a4" [5]=> string(2) "a5" [6]=> string(2) "a6" [7]=> string(2) "a7" [8]=> string(2) "" [9]=> string(2) "" [10]=> string(2) "�(" [11]=> string(2) "�*" [12]=> string(2) "-" [13]=> string(2) "`/" [14]=> string(2) "�1" [15]=> string(2) "�/" } 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 5.3.1
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(40) "Parameter #8 [ <optional> $ = 'string' ]" [9]=> string(36) "Parameter #9 [ <optional> &$ = 111 ]" [10]=> string(46) "Parameter #10 [ <optional> array $ � = Array ]" [11]=> string(54) "Parameter #11 [ <optional> array or NULL &$(� = NULL ]" [12]=> string(52) "Parameter #12 [ <optional> Type or NULL $X� = NULL ]" [13]=> string(53) "Parameter #13 [ <optional> Type or NULL &$�� = NULL ]" [14]=> string(63) "Parameter #14 [ <optional> Namespaced\Type or NULL $0� = NULL ]" [15]=> string(64) "Parameter #15 [ <optional> Namespaced\Type or NULL &$�� = NULL ]" } array(16) { [0]=> string(2) "a0" [1]=> string(2) "a1" [2]=> string(2) "a2" [3]=> string(2) "a3" [4]=> string(2) "a4" [5]=> string(2) "a5" [6]=> string(2) "a6" [7]=> string(2) "a7" [8]=> string(2) "" [9]=> string(2) "" [10]=> string(2) " �" [11]=> string(2) "(�" [12]=> string(2) "X�" [13]=> string(2) "��" [14]=> string(2) "0�" [15]=> string(2) "��" } 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 5.3.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(40) "Parameter #8 [ <optional> $ = 'string' ]" [9]=> string(36) "Parameter #9 [ <optional> &$ = 111 ]" [10]=> string(46) "Parameter #10 [ <optional> array $@� = Array ]" [11]=> string(54) "Parameter #11 [ <optional> array or NULL &$H� = NULL ]" [12]=> string(52) "Parameter #12 [ <optional> Type or NULL $x� = NULL ]" [13]=> string(53) "Parameter #13 [ <optional> Type or NULL &$Г = NULL ]" [14]=> string(63) "Parameter #14 [ <optional> Namespaced\Type or NULL $P� = NULL ]" [15]=> string(64) "Parameter #15 [ <optional> Namespaced\Type or NULL &$� = NULL ]" } array(16) { [0]=> string(2) "a0" [1]=> string(2) "a1" [2]=> string(2) "a2" [3]=> string(2) "a3" [4]=> string(2) "a4" [5]=> string(2) "a5" [6]=> string(2) "a6" [7]=> string(2) "a7" [8]=> string(2) "" [9]=> string(2) "" [10]=> string(2) "@�" [11]=> string(2) "H�" [12]=> string(2) "x�" [13]=> string(2) "Г" [14]=> string(2) "P�" [15]=> string(2) "�" } 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/L4duP 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/L4duP on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/L4duP on line 3
Process exited with code 255.