3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump((object) ['' => 'foo']); var_dump((object) ["\0*\0" => 'foo']); var_dump((object) ["\0Foo\0" => 'foo']);
Output for 5.6.21, 7.0.6 - 7.0.20, 7.1.0 - 7.1.33, 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.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
object(stdClass)#1 (1) { [""]=> string(3) "foo" } object(stdClass)#1 (1) { Notice: Corrupt member variable name in /in/7MO7E on line 4 ["*"]=> string(3) "foo" } object(stdClass)#1 (1) { Notice: Corrupt member variable name in /in/7MO7E on line 5 ["Foo"]=> string(3) "foo" }
Output for 7.3.32 - 7.3.33
object(stdClass)#1 (1) { [""]=> string(3) "foo" } object(stdClass)#1 (1) { ["*"]=> string(3) "foo" } object(stdClass)#1 (1) { ["Foo"]=> string(3) "foo" }
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.20, 7.0.0 - 7.0.5
object(stdClass)#1 (1) { Notice: Illegal member variable name in /in/7MO7E on line 3 [""]=> string(3) "foo" } object(stdClass)#1 (1) { Notice: Corrupt member variable name in /in/7MO7E on line 4 ["*"]=> string(3) "foo" } object(stdClass)#1 (1) { Notice: Corrupt member variable name in /in/7MO7E on line 5 ["Foo"]=> string(3) "foo" }

preferences:
131.7 ms | 410 KiB | 5 Q