3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $x = [ '"\"', '001', 'nulll', '""' ]; foreach ($x as $y) { var_dump([json_decode($y), json_last_error_msg()]); }
based on VvCAj
Output for 7.0.0 - 7.2.0
array(2) { [0]=> NULL [1]=> string(53) "Control character error, possibly incorrectly encoded" } array(2) { [0]=> NULL [1]=> string(12) "Syntax error" } array(2) { [0]=> NULL [1]=> string(12) "Syntax error" } array(2) { [0]=> string(0) "" [1]=> string(8) "No error" }
Output for 5.5.24 - 5.6.28
array(2) { [0]=> NULL [1]=> string(12) "Syntax error" } array(2) { [0]=> int(1) [1]=> string(8) "No error" } array(2) { [0]=> NULL [1]=> string(12) "Syntax error" } array(2) { [0]=> string(0) "" [1]=> string(8) "No error" }
Output for 5.4.2 - 5.4.45
Fatal error: Call to undefined function json_last_error_msg() in /in/fpqB8 on line 8
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/fpqB8 on line 3
Process exited with code 255.