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); var_dump(json_last_error()); /*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
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/KSg5G
function name:  (null)
number of ops:  31
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
    5     4      > JMPZ                                                     <true>, ->10
    6     5    >   INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'json_last_error_msg'
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                                 
    9    10    >   INIT_FCALL                                               'var_dump'
         11        SEND_VAL                                                 'JSON_ERROR_DEPTH+%3A+1'
         12        DO_ICALL                                                 
   10    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAL                                                 'JSON_ERROR_STATE_MISMATCH+%3A+2'
         15        DO_ICALL                                                 
   11    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAL                                                 'JSON_ERROR_CTRL_CHAR+%3A+3'
         18        DO_ICALL                                                 
   12    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAL                                                 'JSON_ERROR_SYNTAX+%3A+4'
         21        DO_ICALL                                                 
   13    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAL                                                 'JSON_ERROR_UTF8+%3A+5'
         24        DO_ICALL                                                 
   15    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL                                               'json_last_error'
         27        DO_ICALL                                         $10     
         28        SEND_VAR                                                 $10
         29        DO_ICALL                                                 
   38    30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.67 ms | 1396 KiB | 21 Q