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 { 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); echo $ser = serialize($test), "\n"; $try = unserialize($ser);
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
C:11:"RoleStorage":96:{x:i:2;O:6:"RefMef":1:{s:9:"RefMef_";O:6:"RefMef":1:{s:9:"RefMef_";i:1;}},N;;r:4;,N;;m:a:0:{}} string(96) "x:i:2;O:6:"RefMef":1:{s:9:"RefMef_";O:6:"RefMef":1:{s:9:"RefMef_";i:1;}},N;;r:4;,N;;m:a:0:{}"
Output for hhvm-3.12.0
C:11:"RoleStorage":216:{a:2:{s:32:"0000000000000000ee1ec1451cb5a25e";a:2:{s:3:"obj";O:6:"RefMef":1:{s:9:"RefMef_";O:6:"RefMef":1:{s:9:"RefMef_";i:1;}}s:3:"inf";N;}s:32:"0000000000000000ee1ec1451cb5a22e";a:2:{s:3:"obj";r:4;s:3:"inf";N;}}} string(216) "a:2:{s:32:"0000000000000000ee1ec1451cb5a25e";a:2:{s:3:"obj";O:6:"RefMef":1:{s:9:"RefMef_";O:6:"RefMef":1:{s:9:"RefMef_";i:1;}}s:3:"inf";N;}s:32:"0000000000000000ee1ec1451cb5a22e";a:2:{s:3:"obj";r:4;s:3:"inf";N;}}"
Output for hhvm-3.10.0
C:11:"RoleStorage":216:{a:2:{s:32:"0000000000000000feb70055ef1d539f";a:2:{s:3:"obj";O:6:"RefMef":1:{s:9:"RefMef_";O:6:"RefMef":1:{s:9:"RefMef_";i:1;}}s:3:"inf";N;}s:32:"0000000000000000feb70055ef1d53ef";a:2:{s:3:"obj";r:4;s:3:"inf";N;}}} string(216) "a:2:{s:32:"0000000000000000feb70055ef1d539f";a:2:{s:3:"obj";O:6:"RefMef":1:{s:9:"RefMef_";O:6:"RefMef":1:{s:9:"RefMef_";i:1;}}s:3:"inf";N;}s:32:"0000000000000000feb70055ef1d53ef";a:2:{s:3:"obj";r:4;s:3:"inf";N;}}"
Output for 5.3.0 - 5.3.29
C:11:"RoleStorage":96:{x:i:2;O:6:"RefMef":1:{s:9:"RefMef_";O:6:"RefMef":1:{s:9:"RefMef_";i:1;}},N;;r:2;,N;;m:a:0:{}} string(96) "x:i:2;O:6:"RefMef":1:{s:9:"RefMef_";O:6:"RefMef":1:{s:9:"RefMef_";i:1;}},N;;r:2;,N;;m:a:0:{}"
Output for 5.2.2 - 5.2.17
C:11:"RoleStorage":90:{x:i:2;O:6:"RefMef":1:{s:9:"RefMef_";O:6:"RefMef":1:{s:9:"RefMef_";i:1;}};r:2;;m:a:0:{}} string(90) "x:i:2;O:6:"RefMef":1:{s:9:"RefMef_";O:6:"RefMef":1:{s:9:"RefMef_";i:1;}};r:2;;m:a:0:{}"
Output for 5.1.0 - 5.2.1
O:11:"RoleStorage":0:{}
Output for 5.0.0 - 5.0.5
Fatal error: Class 'SPLObjectStorage' not found in /in/etitf on line 11
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/etitf 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/etitf 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/etitf on line 5
Process exited with code 255.