3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { public function __construct($foo, $bar, $foo) {} } $r = new ReflectionClass('Foo'); $params = $r->getConstructor()->getParameters(); var_export($params[2]->name); echo "\n\n"; echo json_encode($params[2]->name[0]); echo "\n\n"; var_export(json_encode($params[2]->name[0]) == '"\u0000"');
Output for 5.3.6 - 5.6.28
'foo' "f" false
Output for 5.2.6 - 5.3.5
'' . "\0" . '' . "\0" . '' . "\0" . '' "\u0000" true
Output for 5.2.2 - 5.2.5
'\000\000\000' "\u0000" true
Output for 5.2.0 - 5.2.1
'\000\000\000' "" false
Output for 5.0.0 - 5.1.6
'foo' Fatal error: Call to undefined function json_encode() in /in/MfiZl on line 13
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/MfiZl on line 5
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, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/MfiZl on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/MfiZl on line 5
Process exited with code 255.