3v4l.org

run code in 300+ PHP versions simultaneously
<?php ob_start(); //simulating a JSON output ?> { "date": { "epoch": "1413648000", "pretty": "07:00 PM IDT , אוקטובר 18, 2014", "day": 18, "month": 10, "year": 2014, "yday": 290, "hour": 19, "min": "00", "sec": 0, "isdst": "1", "monthname": "אוקטובר", "monthname_short": "אוק", "weekday_short": "שבת", "weekday": "שבת", "ampm": "PM", "tz_short": "IDT", "tz_long": "Asia/Jerusalem" }, "period": 10, "high": { "fahrenheit": "84", "celsius": "29" }, "low": { "fahrenheit": "66", "celsius": "19" }, "conditions": "בהיר", "icon": "clear", "icon_url": "http://icons.wxug.com/i/c/k/clear.gif", "skyicon": "", "pop": 0, "qpf_allday": { "in": 0, "mm": 0 }, "qpf_day": { "in": 0, "mm": 0 }, "qpf_night": { "in": 0, "mm": 0 }, "snow_allday": { "in": 0, "cm": 0 }, "snow_day": { "in": 0, "cm": 0 }, "snow_night": { "in": 0, "cm": 0 }, "maxwind": { "mph": 15, "kph": 24, "dir": "צ", "degrees": 351 }, "avewind": { "mph": 10, "kph": 16, "dir": "צ", "degrees": 351 }, "avehumidity": 52, "maxhumidity": 0, "minhumidity": 0 } <?php $sJSONBuffer = ob_get_contents(); ob_end_clean(); //$sJSONBuffer = utf8_encode($sJSONBuffer); $aJSONStruct = json_decode($sJSONBuffer, true); var_dump($aJSONStruct); //print($sJSONBuffer); //echo 'errore '.json_last_error().''."\n"; switch (json_last_error()) { case JSON_ERROR_NONE: echo ' - No errors'; break; case JSON_ERROR_DEPTH: echo ' - Maximum stack depth exceeded'; break; case JSON_ERROR_STATE_MISMATCH: echo ' - Underflow or the modes mismatch'; break; case JSON_ERROR_CTRL_CHAR: echo ' - Unexpected control character found'; break; case JSON_ERROR_SYNTAX: echo ' - Syntax error, malformed JSON'; break; case JSON_ERROR_UTF8: echo ' - Malformed UTF-8 characters, possibly incorrectly encoded'; break; default: echo ' - Unknown error'; break; } echo 'errore '.json_last_error_msg().''."\n"; ?>
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
array(20) { ["date"]=> array(17) { ["epoch"]=> string(10) "1413648000" ["pretty"]=> string(38) "07:00 PM IDT , אוקטובר 18, 2014" ["day"]=> int(18) ["month"]=> int(10) ["year"]=> int(2014) ["yday"]=> int(290) ["hour"]=> int(19) ["min"]=> string(2) "00" ["sec"]=> int(0) ["isdst"]=> string(1) "1" ["monthname"]=> string(14) "אוקטובר" ["monthname_short"]=> string(6) "אוק" ["weekday_short"]=> string(6) "שבת" ["weekday"]=> string(6) "שבת" ["ampm"]=> string(2) "PM" ["tz_short"]=> string(3) "IDT" ["tz_long"]=> string(14) "Asia/Jerusalem" } ["period"]=> int(10) ["high"]=> array(2) { ["fahrenheit"]=> string(2) "84" ["celsius"]=> string(2) "29" } ["low"]=> array(2) { ["fahrenheit"]=> string(2) "66" ["celsius"]=> string(2) "19" } ["conditions"]=> string(8) "בהיר" ["icon"]=> string(5) "clear" ["icon_url"]=> string(37) "http://icons.wxug.com/i/c/k/clear.gif" ["skyicon"]=> string(0) "" ["pop"]=> int(0) ["qpf_allday"]=> array(2) { ["in"]=> int(0) ["mm"]=> int(0) } ["qpf_day"]=> array(2) { ["in"]=> int(0) ["mm"]=> int(0) } ["qpf_night"]=> array(2) { ["in"]=> int(0) ["mm"]=> int(0) } ["snow_allday"]=> array(2) { ["in"]=> int(0) ["cm"]=> int(0) } ["snow_day"]=> array(2) { ["in"]=> int(0) ["cm"]=> int(0) } ["snow_night"]=> array(2) { ["in"]=> int(0) ["cm"]=> int(0) } ["maxwind"]=> array(4) { ["mph"]=> int(15) ["kph"]=> int(24) ["dir"]=> string(2) "צ" ["degrees"]=> int(351) } ["avewind"]=> array(4) { ["mph"]=> int(10) ["kph"]=> int(16) ["dir"]=> string(2) "צ" ["degrees"]=> int(351) } ["avehumidity"]=> int(52) ["maxhumidity"]=> int(0) ["minhumidity"]=> int(0) } - No errorserrore No error
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45
array(20) { ["date"]=> array(17) { ["epoch"]=> string(10) "1413648000" ["pretty"]=> string(38) "07:00 PM IDT , אוקטובר 18, 2014" ["day"]=> int(18) ["month"]=> int(10) ["year"]=> int(2014) ["yday"]=> int(290) ["hour"]=> int(19) ["min"]=> string(2) "00" ["sec"]=> int(0) ["isdst"]=> string(1) "1" ["monthname"]=> string(14) "אוקטובר" ["monthname_short"]=> string(6) "אוק" ["weekday_short"]=> string(6) "שבת" ["weekday"]=> string(6) "שבת" ["ampm"]=> string(2) "PM" ["tz_short"]=> string(3) "IDT" ["tz_long"]=> string(14) "Asia/Jerusalem" } ["period"]=> int(10) ["high"]=> array(2) { ["fahrenheit"]=> string(2) "84" ["celsius"]=> string(2) "29" } ["low"]=> array(2) { ["fahrenheit"]=> string(2) "66" ["celsius"]=> string(2) "19" } ["conditions"]=> string(8) "בהיר" ["icon"]=> string(5) "clear" ["icon_url"]=> string(37) "http://icons.wxug.com/i/c/k/clear.gif" ["skyicon"]=> string(0) "" ["pop"]=> int(0) ["qpf_allday"]=> array(2) { ["in"]=> int(0) ["mm"]=> int(0) } ["qpf_day"]=> array(2) { ["in"]=> int(0) ["mm"]=> int(0) } ["qpf_night"]=> array(2) { ["in"]=> int(0) ["mm"]=> int(0) } ["snow_allday"]=> array(2) { ["in"]=> int(0) ["cm"]=> int(0) } ["snow_day"]=> array(2) { ["in"]=> int(0) ["cm"]=> int(0) } ["snow_night"]=> array(2) { ["in"]=> int(0) ["cm"]=> int(0) } ["maxwind"]=> array(4) { ["mph"]=> int(15) ["kph"]=> int(24) ["dir"]=> string(2) "צ" ["degrees"]=> int(351) } ["avewind"]=> array(4) { ["mph"]=> int(10) ["kph"]=> int(16) ["dir"]=> string(2) "צ" ["degrees"]=> int(351) } ["avehumidity"]=> int(52) ["maxhumidity"]=> int(0) ["minhumidity"]=> int(0) } - No errors Fatal error: Call to undefined function json_last_error_msg() in /in/p8INe on line 113
Process exited with code 255.
Output for 5.2.0 - 5.2.17
array(20) { ["date"]=> array(17) { ["epoch"]=> string(10) "1413648000" ["pretty"]=> string(38) "07:00 PM IDT , אוקטובר 18, 2014" ["day"]=> int(18) ["month"]=> int(10) ["year"]=> int(2014) ["yday"]=> int(290) ["hour"]=> int(19) ["min"]=> string(2) "00" ["sec"]=> int(0) ["isdst"]=> string(1) "1" ["monthname"]=> string(14) "אוקטובר" ["monthname_short"]=> string(6) "אוק" ["weekday_short"]=> string(6) "שבת" ["weekday"]=> string(6) "שבת" ["ampm"]=> string(2) "PM" ["tz_short"]=> string(3) "IDT" ["tz_long"]=> string(14) "Asia/Jerusalem" } ["period"]=> int(10) ["high"]=> array(2) { ["fahrenheit"]=> string(2) "84" ["celsius"]=> string(2) "29" } ["low"]=> array(2) { ["fahrenheit"]=> string(2) "66" ["celsius"]=> string(2) "19" } ["conditions"]=> string(8) "בהיר" ["icon"]=> string(5) "clear" ["icon_url"]=> string(37) "http://icons.wxug.com/i/c/k/clear.gif" ["skyicon"]=> string(0) "" ["pop"]=> int(0) ["qpf_allday"]=> array(2) { ["in"]=> int(0) ["mm"]=> int(0) } ["qpf_day"]=> array(2) { ["in"]=> int(0) ["mm"]=> int(0) } ["qpf_night"]=> array(2) { ["in"]=> int(0) ["mm"]=> int(0) } ["snow_allday"]=> array(2) { ["in"]=> int(0) ["cm"]=> int(0) } ["snow_day"]=> array(2) { ["in"]=> int(0) ["cm"]=> int(0) } ["snow_night"]=> array(2) { ["in"]=> int(0) ["cm"]=> int(0) } ["maxwind"]=> array(4) { ["mph"]=> int(15) ["kph"]=> int(24) ["dir"]=> string(2) "צ" ["degrees"]=> int(351) } ["avewind"]=> array(4) { ["mph"]=> int(10) ["kph"]=> int(16) ["dir"]=> string(2) "צ" ["degrees"]=> int(351) } ["avehumidity"]=> int(52) ["maxhumidity"]=> int(0) ["minhumidity"]=> int(0) } Fatal error: Call to undefined function json_last_error() in /in/p8INe on line 90
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Call to undefined function json_decode() in /in/p8INe on line 85
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_decode() in /in/p8INe on line 85
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: json_decode() in /in/p8INe on line 85
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_decode() in /in/p8INe on line 85

preferences:
319.84 ms | 405 KiB | 460 Q