3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $json = <<<JSON [ { "foo": "bar", "subject": "some subject" }, { "qux": "baz", "subject": "some other subject" } ] JSON; $data = json_decode($json, true); // true is important otherwise will get a stdObject - not an array $subjects = array(); foreach ($data as $a) { $subjects[] = $a['subject']; } var_dump($subjects);
Output for 5.2.0 - 7.1.0
array(2) { [0]=> string(12) "some subject" [1]=> string(18) "some other subject" }
Output for 5.0.0 - 5.1.1, 5.1.3 - 5.1.6
Fatal error: Call to undefined function json_decode() in /in/AIr3N on line 16
Process exited with code 255.
Output for 5.1.2
Fatal error: Call to undefined function json_decode() in /in/AIr3N on line 17
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_decode() in /in/AIr3N on line 16
Process exited with code 255.
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.4
Fatal error: Call to undefined function: json_decode() in /in/AIr3N on line 16
Process exited with code 255.
Output for 4.4.2
Fatal error: Call to undefined function: json_decode() in /in/AIr3N on line 17
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_decode() in /in/AIr3N on line 16