3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php interface Connection { function prepare($statement); } class MyPDO { public function prepare($statement, $options = NULL) { print("MyPDO::prepare()\n"); } } class PDOConnection extends MyPDO implements Connection { } var_dump((new ReflectionClass('MyPDO'))->getMethod('prepare')->getParameters());
based on 1mh1E
Output for 7.0.0 - 7.1.0
array(2) { [0]=> object(ReflectionParameter)#1 (1) { ["name"]=> string(9) "statement" } [1]=> object(ReflectionParameter)#3 (1) { ["name"]=> string(7) "options" } }
Output for hhvm-3.12.0
array(2) { [0]=> object(ReflectionParameter)#3 (3) { ["info"]=> array(11) { ["index"]=> int(0) ["name"]=> string(9) "statement" ["type"]=> string(0) "" ["type_hint"]=> string(0) "" ["type_hint_builtin"]=> bool(false) ["function"]=> string(7) "prepare" ["class"]=> string(5) "MyPDO" ["nullable"]=> bool(true) ["type_hint_nullable"]=> bool(true) ["attributes"]=> array(0) { } ["is_optional"]=> bool(false) } ["name"]=> string(9) "statement" ["paramTypeInfo"]=> array(3) { ["name"]=> string(0) "" ["nullable"]=> bool(true) ["builtin"]=> bool(false) } } [1]=> object(ReflectionParameter)#4 (3) { ["info"]=> array(13) { ["index"]=> int(1) ["name"]=> string(7) "options" ["type"]=> string(0) "" ["type_hint"]=> string(0) "" ["type_hint_builtin"]=> bool(false) ["function"]=> string(7) "prepare" ["class"]=> string(5) "MyPDO" ["nullable"]=> bool(true) ["type_hint_nullable"]=> bool(true) ["default"]=> NULL ["defaultText"]=> string(4) "NULL" ["attributes"]=> array(0) { } ["is_optional"]=> bool(true) } ["name"]=> string(7) "options" ["paramTypeInfo"]=> array(3) { ["name"]=> string(0) "" ["nullable"]=> bool(true) ["builtin"]=> bool(false) } } }
Output for hhvm-3.10.0
array(2) { [0]=> object(ReflectionParameter)#3 (2) { ["info"]=> array(9) { ["index"]=> int(0) ["name"]=> string(9) "statement" ["type"]=> string(0) "" ["type_hint"]=> string(0) "" ["function"]=> string(7) "prepare" ["class"]=> string(5) "MyPDO" ["nullable"]=> bool(true) ["attributes"]=> array(0) { } ["is_optional"]=> bool(false) } ["name"]=> string(9) "statement" } [1]=> object(ReflectionParameter)#4 (2) { ["info"]=> array(11) { ["index"]=> int(1) ["name"]=> string(7) "options" ["type"]=> string(0) "" ["type_hint"]=> string(0) "" ["function"]=> string(7) "prepare" ["class"]=> string(5) "MyPDO" ["nullable"]=> bool(true) ["default"]=> NULL ["defaultText"]=> string(4) "NULL" ["attributes"]=> array(0) { } ["is_optional"]=> bool(true) } ["name"]=> string(7) "options" } }
Output for 5.4.0 - 5.6.28
array(2) { [0]=> &object(ReflectionParameter)#1 (1) { ["name"]=> string(9) "statement" } [1]=> &object(ReflectionParameter)#3 (1) { ["name"]=> string(7) "options" } }
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/o4AEn on line 20
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/o4AEn on line 20
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/o4AEn on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING in /in/o4AEn on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/o4AEn on line 3
Process exited with code 255.