3v4l.org

run code in 300+ PHP versions simultaneously
<?php ob_start(); //simulating a JSON output ?> { "date": { "epoch": "1413043200", "pretty": "07:00 PM IDT , אוקטובר 11, 2014", "day": 11, "month": 10, "year": 2014, "yday": 283, "hour": 19, "min": "00", "sec": 0, "isdst": "1", "monthname": "אוקטובר", "monthname_short": "אוק", "weekday_short": "שבת", "weekday": "שבת", "ampm": "PM", "tz_short": "IDT", "tz_long": "Asia/Jerusalem" }, "period": 3, "high": { "fahrenheit": "86", "celsius": "30" }, "low": { "fahrenheit": "67", "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": 326 }, "avewind": { "mph": 11, "kph": 18, "dir": "צ-מע", "degrees": 326 }, "avehumidity": 57, "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"; ?>

preferences:
44.17 ms | 402 KiB | 5 Q