3v4l.org

run code in 300+ PHP versions simultaneously
<?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'));
Output for 8.3.0 - 8.3.4, 8.3.6
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;" Warning: unserialize(): Error at offset 10 of 10 bytes in /in/a45bm on line 10 bool(false) int(1) Warning: unserialize(): Error at offset 0 of 3 bytes in /in/a45bm on line 12 bool(false) array(0) { } Warning: unserialize(): Error at offset 0 of 5 bytes in /in/a45bm on line 14 bool(false) Warning: unserialize(): Error at offset 0 of 1 bytes in /in/a45bm on line 15 bool(false)
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 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;" Warning: unserialize(): Error at offset 10 of 10 bytes in /in/a45bm on line 10 bool(false) int(1) Warning: unserialize(): Error at offset 0 of 3 bytes in /in/a45bm on line 12 bool(false) array(0) { } Warning: unserialize(): Error at offset 0 of 5 bytes in /in/a45bm on line 14 bool(false) Warning: unserialize(): Error at offset 0 of 1 bytes in /in/a45bm on line 15 bool(false)
Output for 5.6.21, 7.0.6 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
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 7.3.32 - 7.3.33
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;" bool(false) int(1) bool(false) array(0) { } bool(false) bool(false)
Output for 5.5.0 - 5.5.35, 5.6.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)

preferences:
187.74 ms | 402 KiB | 227 Q