3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class RefMef { private $_; public function __construct($ref) { $this->_ = $ref; } } class RoleStorage extends SPLObjectStorage { private $membres; public function serialize() { return parent::serialize(); } public function unserialize($serialized) { var_dump($serialized); parent::unserialize($serialized); } } $obj1 = new RefMef(1); $obj2 = new RefMef($obj1); $test = new RoleStorage; // $test->attach($obj2); // $test->attach($obj1); // $test->attach($test); echo $ser = serialize($test), "\n"; $try = unserialize($ser); // $test = unserialize('C:11:"RoleStorage":23:{x:i:1;N;,r:13;;m:a:0:{}}');
Output for 5.2.2 - 7.1.0
C:11:"RoleStorage":44:{x:i:0;m:a:1:{s:20:"RoleStoragemembres";N;}} string(44) "x:i:0;m:a:1:{s:20:"RoleStoragemembres";N;}"
Output for 5.1.1 - 5.2.1
O:11:"RoleStorage":1:{s:20:"RoleStoragemembres";N;}
Output for 5.1.0
<br /> <b>Fatal error</b>: fatal flex scanner internal error--end of buffer missed in <b>/in/jNLZM</b> on line <b>36</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.0.5
<br /> <b>Fatal error</b>: Class 'SPLObjectStorage' not found in <b>/in/jNLZM</b> on line <b>11</b><br />
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/jNLZM</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/jNLZM</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/jNLZM</b> on line <b>5</b><br />
Process exited with code 255.