3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = json_encode('wrong json'); /*if ('50500' <= PHP_VERSION_ID) { var_dump(json_last_error_msg()); }*/ var_dump('JSON_ERROR_DEPTH' . ' : ' . JSON_ERROR_DEPTH); var_dump('JSON_ERROR_STATE_MISMATCH' . ' : ' . JSON_ERROR_STATE_MISMATCH); var_dump('JSON_ERROR_CTRL_CHAR' . ' : ' . JSON_ERROR_CTRL_CHAR); var_dump('JSON_ERROR_SYNTAX' . ' : ' . JSON_ERROR_SYNTAX); var_dump('JSON_ERROR_UTF8' . ' : ' . JSON_ERROR_UTF8); /*switch (json_last_error()) { case JSON_ERROR_DEPTH: $error = 'Maximum stack depth exceeded'; break; case JSON_ERROR_STATE_MISMATCH: $error = 'Underflow or the modes mismatch'; break; case JSON_ERROR_CTRL_CHAR: $error = 'Unexpected control character found'; break; case JSON_ERROR_SYNTAX: $error = 'Syntax error, malformed JSON'; break; case JSON_ERROR_UTF8: $error = 'Malformed UTF-8 characters, possibly incorrectly encoded'; break; default: $error = 'Unknown error'; break; } var_dump($error);*/
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V4IU8
function name:  (null)
number of ops:  20
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'json_encode'
          1        SEND_VAL                                                 'wrong+json'
          2        DO_ICALL                                         $1      
          3        ASSIGN                                                   !0, $1
    9     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAL                                                 'JSON_ERROR_DEPTH+%3A+1'
          6        DO_ICALL                                                 
   10     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAL                                                 'JSON_ERROR_STATE_MISMATCH+%3A+2'
          9        DO_ICALL                                                 
   11    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAL                                                 'JSON_ERROR_CTRL_CHAR+%3A+3'
         12        DO_ICALL                                                 
   12    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAL                                                 'JSON_ERROR_SYNTAX+%3A+4'
         15        DO_ICALL                                                 
   13    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAL                                                 'JSON_ERROR_UTF8+%3A+5'
         18        DO_ICALL                                                 
   36    19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.71 ms | 1386 KiB | 17 Q