3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function mess($x) { return unserialize(serialize($x)); } class X { public $name; function __invoke() {} } class Wrapper { public $x; } $wrapper = new Wrapper; $wrapper->x = new X; $wrapper->x->name = 'THENAME'; $wrapper2 = new Wrapper; $wrapper2->x = $wrapper->x; var_export($wrapper->x === $wrapper2->x); var_export(mess($wrapper->x)); var_export(mess($wrapper2->x)); var_export(mess($wrapper->x) === mess($wrapper2->x));
Output for 5.1.0 - 7.1.0
trueX::__set_state(array( 'name' => 'THENAME', ))X::__set_state(array( 'name' => 'THENAME', ))false
Output for 5.0.0 - 5.0.5
trueclass X { public $name = 'THENAME'; }class X { public $name = 'THENAME'; }false
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/eGLsX on line 7
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/eGLsX on line 7
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/eGLsX on line 7
Process exited with code 255.