3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class SomeCollection extends ArrayObject {} $meh = unserialize('O:14:"SomeCollection":1:{i:0;s:4:"item";}'); var_dump('yay', $meh); $meh = unserialize('C:14:"SomeCollection":36:{x:i:0;a:1:{i:0;s:4:"item";};m:a:0:{}}'); var_dump('yay', $meh);
Output for 5.4.29, 5.5.13, 5.6.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: Erroneous data format for unserializing 'SomeCollection' in /in/T6ZqS on line 6 Notice: unserialize(): Error at offset 25 of 41 bytes in /in/T6ZqS on line 6 string(3) "yay" bool(false) string(3) "yay" object(SomeCollection)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> string(4) "item" } }
Output for hhvm-3.10.0 - 3.13.2
string(3) "yay" object(SomeCollection)#1 (2) { ["0"]=> string(4) "item" ["storage":"ArrayObject":private]=> array(0) { } } Notice: Unable to unserialize: [x:i:0;a:1:{i:0;s:4:"item";};m:a:0:{}]. Unknown type 'x'. Warning: Invalid argument supplied for foreach() in /in/T6ZqS on line 8 string(3) "yay" object(SomeCollection)#2 (1) { ["storage":"ArrayObject":private]=> array(0) { } }
Output for 5.3.9 - 5.4.28, 5.4.30 - 5.5.12, 5.5.14 - 5.5.38
string(3) "yay" object(SomeCollection)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { ["0"]=> string(4) "item" } } string(3) "yay" object(SomeCollection)#2 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> string(4) "item" } }
Output for 5.3.0 - 5.3.8
string(3) "yay" object(SomeCollection)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> string(4) "item" } } string(3) "yay" object(SomeCollection)#2 (1) { ["storage":"ArrayObject":private]=> array(1) { [0]=> string(4) "item" } }
Output for 5.1.0 - 5.2.17
string(3) "yay" object(SomeCollection)#1 (1) { [0]=> string(4) "item" } Warning: Class SomeCollection has no unserializer in /in/T6ZqS on line 8 Notice: unserialize(): Error at offset 20 of 63 bytes in /in/T6ZqS on line 8 string(3) "yay" bool(false)
Output for 5.0.0 - 5.0.5
string(3) "yay" object(SomeCollection)#1 (1) { [0]=> string(4) "item" } Notice: unserialize(): Error at offset 0 of 63 bytes in /in/T6ZqS on line 8 string(3) "yay" bool(false)
Output for 4.3.2 - 4.4.9
Fatal error: Class somecollection: Cannot inherit from undefined class arrayobject in /in/T6ZqS on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Class somecollection: Cannot inherit from undefined class arrayobject in /in/T6ZqS on line 3