3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { protected $bar; private $foo; } $foo = new Foo(); $a = eval('return ' . var_export($foo, true) . ';'); var_dump($a); var_export((array) $foo); var_dump( $foo->{"\0*\0bar"}, $foo->{"\0Foo\0foo"} ); $foo->{"\0*\0bar"} = 'baz'; $foo->{"\0Foo\0foo"} = 'bar'; var_dump(array($foo));
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined method Foo::__set_state() in /in/A0jhI(11) : eval()'d code:1 Stack trace: #0 /in/A0jhI(11): eval() #1 {main} thrown in /in/A0jhI(11) : eval()'d code on line 1
Process exited with code 255.
Output for 5.2.3 - 5.6.28
Fatal error: Call to undefined method Foo::__set_state() in /in/A0jhI(11) : eval()'d code on line 1
Process exited with code 255.
Output for 5.1.0 - 5.2.2
<br /> <b>Fatal error</b>: Call to undefined method Foo::__set_state() in <b>/in/A0jhI(11) : eval()'d code</b> on line <b>1</b><br />
Process exited with code 255.
Output for 5.0.5
<br /> <b>Parse error</b>: parse error, unexpected T_CLASS in <b>/in/A0jhI(11) : eval()'d code</b> on line <b>1</b><br /> bool(false) array ( '*bar' => NULL, 'Foofoo' => NULL, )<br /> <b>Fatal error</b>: Cannot access property started with '\0' in <b>/in/A0jhI</b> on line <b>16</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.0.4
<br /> <b>Parse error</b>: parse error, unexpected T_CLASS in <b>/in/A0jhI(11) : eval()'d code</b> on line <b>1</b><br /> bool(false) array ( '*bar' => NULL, 'Foofoo' => NULL, )NULL NULL array(1) { [0]=> object(Foo)#1 (2) { ["bar:protected"]=> string(3) "baz" ["foo:private"]=> string(3) "bar" } }
Process exited with code 255.
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/A0jhI</b> on line <b>5</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/A0jhI</b> on line <b>5</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in <b>/in/A0jhI</b> on line <b>5</b><br />
Process exited with code 255.