3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array("abc\0def" => "abc\0def"); $obj = (object)$arr; print_r($arr); echo "\n"; var_dump($obj); echo "\n"; echo serialize($obj); echo "\n"; echo (int)property_exists($obj, "abc"); echo "\n"; echo (int)isset($obj->{"abc"}); echo "\n"; echo json_encode($obj); echo "\n"; var_dump((array)$obj); echo "\n"; var_export($obj); echo "\n"; print_r($obj); echo "\n"; debug_zval_dump($obj); echo "\n"; var_dump(get_object_vars($obj)); echo "\n"; $b = get_object_vars($obj); echo $b["abc"]; echo "\n"; foreach ($obj as $key=>$val) { echo $key." : ".$val."\n"; }
Output for 7.1.0
Array ( [abcdef] => abcdef ) object(stdClass)#1 (1) { ["abcdef"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} 0 0 {"abc\u0000def":"abc\u0000def"} array(1) { ["abcdef"]=> string(7) "abcdef" } stdClass::__set_state(array( 'abcdef' => 'abc' . "\0" . 'def', )) stdClass Object ( [abcdef] => abcdef ) object(stdClass)#1 (1) refcount(2){ ["abc"]=> string(7) "abcdef" refcount(1) } array(1) { ["abcdef"]=> string(7) "abcdef" } Notice: Undefined index: abc in /in/qKQD2 on line 29 abcdef : abcdef
Output for 7.0.0 - 7.0.14
Array ( [abcdef] => abcdef ) object(stdClass)#1 (1) { ["abcdef"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} 0 0 {"abc\u0000def":"abc\u0000def"} array(1) { ["abcdef"]=> string(7) "abcdef" } stdClass::__set_state(array( 'abcdef' => 'abc' . "\0" . 'def', )) stdClass Object ( [abcdef] => abcdef ) object(stdClass)#1 (1) refcount(2){ ["abc"]=> string(7) "abcdef" refcount(2) } array(1) { ["abcdef"]=> string(7) "abcdef" } Notice: Undefined index: abc in /in/qKQD2 on line 29 abcdef : abcdef
Output for hhvm-3.10.0 - 3.12.0
Array ( [abcdef] => abcdef ) object(stdClass)#1 (1) { ["abcdef"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} 0 0 {"abc\u0000def":"abc\u0000def"} array(1) { ["abcdef"]=> string(7) "abcdef" } stdClass::__set_state(array( 'abc' . "\0" . 'def' => 'abc' . "\0" . 'def', )) stdClass Object ( [abcdef] => abcdef ) object(stdClass)#1 (1) refcount(2){ ["abcdef"]=> string(7) "abcdef" refcount(-127) } array(1) { ["abcdef"]=> string(7) "abcdef" } Notice: Undefined index: abc in /in/qKQD2 on line 29 abcdef : abcdef
Output for 5.5.0 - 5.6.28
Array ( [abcdef] => abcdef ) object(stdClass)#1 (1) { ["abcdef"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} 0 0 {"abc\u0000def":"abc\u0000def"} array(1) { ["abcdef"]=> string(7) "abcdef" } stdClass::__set_state(array( 'abc' => 'abc' . "\0" . 'def', )) stdClass Object ( [abcdef] => abcdef ) object(stdClass)#1 (1) refcount(2){ ["abc"]=> string(7) "abcdef" refcount(2) } array(1) { ["abcdef"]=> string(7) "abcdef" } Notice: Undefined index: abc in /in/qKQD2 on line 29 abcdef : abcdef
Output for 5.2.6 - 5.4.45
Array ( [abcdef] => abcdef ) object(stdClass)#1 (1) { ["abcdef"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} 0 0 {"abc\u0000def":"abc\u0000def"} array(1) { ["abcdef"]=> string(7) "abcdef" } stdClass::__set_state(array( 'abc' => 'abc' . "\0" . 'def', )) stdClass Object ( [abc] => abcdef ) object(stdClass)#1 (1) refcount(2){ ["abc"]=> string(7) "abcdef" refcount(2) } array(1) { ["abc"]=> string(7) "abcdef" } abcdef abc : abcdef
Output for 5.2.4 - 5.2.5
Array ( [abcdef] => abcdef ) object(stdClass)#1 (1) { ["abcdef"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} 0 0 {"abc\u0000def":"abc\u0000def"} array(1) { ["abcdef"]=> string(7) "abcdef" } stdClass::__set_state(array( 'abc' => 'abc\000def', )) stdClass Object ( [abc] => abcdef ) object(stdClass)#1 (1) refcount(2){ ["abc"]=> string(7) "abcdef" refcount(2) } array(1) { ["abc"]=> string(7) "abcdef" } abcdef abc : abcdef
Output for 5.2.2 - 5.2.3
Array ( [abcdef] => abcdef ) object(stdClass)#1 (1) { ["abcdef"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} 0 0 {"abc\u0000def":"abc\u0000def"} array(1) { ["abcdef"]=> string(7) "abcdef" } stdClass::__set_state(array( 'abc' => 'abc\000def', )) stdClass Object ( [abc] => abcdef ) object(stdClass)#1 (1) refcount(2){ ["abc"]=> string(7) "abcdef" refcount(2) } array(1) { ["abcdef"]=> string(7) "abcdef" } Notice: Undefined index: abc in /in/qKQD2 on line 29 abc : abcdef
Output for 5.2.0 - 5.2.1
Array ( [abcdef] => abcdef ) object(stdClass)#1 (1) { ["abcdef"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} 0 0 {"abcdef":"abcdef"} array(1) { ["abcdef"]=> string(7) "abcdef" } stdClass::__set_state(array( 'abc' => 'abc\000def', )) stdClass Object ( [abc] => abcdef ) object(stdClass)#1 (1) refcount(2){ ["abc"]=> string(7) "abcdef" refcount(2) } array(1) { ["abcdef"]=> string(7) "abcdef" } Notice: Undefined index: abc in /in/qKQD2 on line 29 abc : abcdef
Output for 5.1.0 - 5.1.6
Array ( [abcdef] => abcdef ) object(stdClass)#1 (1) { ["abc"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} 0 0 Fatal error: Call to undefined function json_encode() in /in/qKQD2 on line 15
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Array ( [abcdef] => abcdef ) object(stdClass)#1 (1) { ["abc"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} Fatal error: Call to undefined function property_exists() in /in/qKQD2 on line 11
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Array ( [abcdef] => abcdef ) object(stdClass)(1) { ["abcdef"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} Fatal error: Call to undefined function: property_exists() in /in/qKQD2 on line 11
Process exited with code 255.
Output for 4.3.5 - 4.4.4
Array ( [abcdef] => abcdef ) object(stdClass)(1) { ["abcdef"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} Fatal error: Call to undefined function: property_exists() in /in/qKQD2 on line 11
Process exited with code 255.
Output for 4.3.3 - 4.3.4
Array ( [abcdef] => abcdef ) object(stdClass)(1) { ["abc"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} Fatal error: Call to undefined function: property_exists() in /in/qKQD2 on line 11
Process exited with code 255.
Output for 4.3.2
Array ( [abc] => abcdef ) object(stdClass)(1) { ["abc"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} Fatal error: Call to undefined function: property_exists() in /in/qKQD2 on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Array ( [abc] => abcdef ) object(stdClass)(1) { ["abc"]=> string(7) "abcdef" } O:8:"stdClass":1:{s:7:"abcdef";s:7:"abcdef";} Fatal error: Call to undefined function: property_exists() in /in/qKQD2 on line 11