3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function guzzle_json_decode($json, $assoc = false, $depth = 512, $options = 0) { $data = \json_decode($json, $assoc, $depth, $options); if (JSON_ERROR_NONE !== json_last_error()) { throw new \InvalidArgumentException( 'json_decode error: ' . json_last_error_msg() ); } return $data; } $json = json_encode(""); var_dump(guzzle_json_decode("", true)); var_dump(json_last_error());
based on ofkkG
Output for 7.0.28 - 7.3.0rc3
Fatal error: Uncaught InvalidArgumentException: json_decode error: Syntax error in /in/KuPCU:7 Stack trace: #0 /in/KuPCU(17): guzzle_json_decode('', true) #1 {main} thrown in /in/KuPCU on line 7
Process exited with code 255.
Output for 5.6.38
NULL int(0)