3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(serialize('test')); var_dump(serialize(1)); var_dump(serialize(true)); var_dump(serialize([])); var_dump(serialize(1.5)); var_dump(serialize(null)); var_dump(unserialize('s:4:"test"')); var_dump(unserialize('i:1;')); var_dump(unserialize('b:1')); var_dump(unserialize('a:0:{}')); var_dump(unserialize('d:1.5')); var_dump(unserialize('N'));
based on Z75QW
Output for 5.6.21, 7.0.6 - 7.3.1
string(11) "s:4:"test";" string(4) "i:1;" string(4) "b:1;" string(6) "a:0:{}" string(6) "d:1.5;" string(2) "N;" Notice: unserialize(): Error at offset 10 of 10 bytes in /in/a45bm on line 10 bool(false) int(1) Notice: unserialize(): Error at offset 0 of 3 bytes in /in/a45bm on line 12 bool(false) array(0) { } Notice: unserialize(): Error at offset 0 of 5 bytes in /in/a45bm on line 14 bool(false) Notice: unserialize(): Error at offset 0 of 1 bytes in /in/a45bm on line 15 bool(false)
Output for 5.5.0 - 5.6.20, 7.0.0 - 7.0.5
string(11) "s:4:"test";" string(4) "i:1;" string(4) "b:1;" string(6) "a:0:{}" string(6) "d:1.5;" string(2) "N;" string(4) "test" int(1) Notice: unserialize(): Error at offset 0 of 3 bytes in /in/a45bm on line 12 bool(false) array(0) { } Notice: unserialize(): Error at offset 0 of 5 bytes in /in/a45bm on line 14 bool(false) Notice: unserialize(): Error at offset 0 of 1 bytes in /in/a45bm on line 15 bool(false)