3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $foo = [""=>""]; $bar = (object)$foo; var_dump($bar); $baz = serialize($bar); var_dump($baz); $bar2 = unserialize($baz); var_dump($bar2);
Output for 5.6.21 - 5.6.28, 7.0.6 - 7.2.6
object(stdClass)#1 (1) { [""]=> string(0) "" } string(33) "O:8:"stdClass":1:{s:0:"";s:0:"";}" object(stdClass)#2 (1) { [""]=> string(0) "" }
Output for 5.4.12 - 5.6.20, 7.0.0 - 7.0.5
object(stdClass)#1 (1) { Notice: Illegal member variable name in /in/7uV45 on line 5 [""]=> string(0) "" } string(33) "O:8:"stdClass":1:{s:0:"";s:0:"";}" object(stdClass)#2 (1) { Notice: Illegal member variable name in /in/7uV45 on line 9 [""]=> string(0) "" }
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/7uV45 on line 3
Process exited with code 255.