3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // prints e.g. 'Current PHP version: 4.1.1' //echo 'Current PHP version: ' . phpversion(); $a = (array)json_decode('{"a2" : {[]: []}}'); var_dump(is_array($a["a2"])); var_dump(array_search("ctf",$a["a2"])); foreach($a["a2"] as $key=>$val){ $val==="ctf"?die("nope"):NULL; } echo "AYEAHFDSFDSAH"; ?>
based on RKAHL
Output for 5.3.0 - 7.2.0
Notice: Undefined index: a2 in /in/W6p9g on line 5 bool(false) Notice: Undefined index: a2 in /in/W6p9g on line 6 Warning: array_search() expects parameter 2 to be array, null given in /in/W6p9g on line 6 NULL Notice: Undefined index: a2 in /in/W6p9g on line 7 Warning: Invalid argument supplied for foreach() in /in/W6p9g on line 7 AYEAHFDSFDSAH
Output for 5.2.1 - 5.2.17
Notice: Undefined index: a2 in /in/W6p9g on line 5 bool(false) Notice: Undefined index: a2 in /in/W6p9g on line 6 Warning: array_search(): Wrong datatype for second argument in /in/W6p9g on line 6 bool(false) Notice: Undefined index: a2 in /in/W6p9g on line 7 Warning: Invalid argument supplied for foreach() in /in/W6p9g on line 7 AYEAHFDSFDSAH
Output for 5.2.0
Notice: Undefined index: a2 in /in/W6p9g on line 5 bool(false) Notice: Undefined index: a2 in /in/W6p9g on line 6 Warning: array_search(): Wrong datatype for second argument in /in/W6p9g on line 6 bool(false) Warning: Invalid argument supplied for foreach() in /in/W6p9g on line 7 AYEAHFDSFDSAH
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function json_decode() in /in/W6p9g on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_decode() in /in/W6p9g on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: json_decode() in /in/W6p9g on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_decode() in /in/W6p9g on line 4