3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = json_encode('wrong json'); /*if ('50500' <= PHP_VERSION_ID) { var_dump(json_last_error_msg()); }*/ 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);
based on vDss3
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
Jump found. Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
Jump found. Position 1 = 12, Position 2 = 21
Branch analysis from position: 12
Jump found. Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
Jump found. Position 1 = 16, Position 2 = 25
Branch analysis from position: 16
Jump found. Position 1 = 27
Branch analysis from position: 27
Jump found. Position 1 = 29
Branch analysis from position: 29
Jump found. Position 1 = -2
Branch analysis from position: 25
Jump found. Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 23
Jump found. Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 21
Jump found. Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 19
Jump found. Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 17
Jump found. Position 1 = 29
Branch analysis from position: 29
filename:       /in/AJ2rp
function name:  (null)
number of ops:  34
compiled vars:  !0 = $a, !1 = $error
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   INIT_FCALL                                               'json_encode'
         1        SEND_VAL                                                 'wrong+json'
         2        DO_ICALL                                         $2      
         3        ASSIGN                                                   !0, $2
   9     4        INIT_FCALL                                               'json_last_error'
         5        DO_ICALL                                         $4      
  10     6        CASE                                             ~5      $4, 1
         7      > JMPNZ                                                    ~5, ->17
  13     8    >   CASE                                             ~5      $4, 2
         9      > JMPNZ                                                    ~5, ->19
  16    10    >   CASE                                             ~5      $4, 3
        11      > JMPNZ                                                    ~5, ->21
  19    12    >   CASE                                             ~5      $4, 4
        13      > JMPNZ                                                    ~5, ->23
  22    14    >   CASE                                             ~5      $4, 5
        15      > JMPNZ                                                    ~5, ->25
        16    > > JMP                                                      ->27
  11    17    >   ASSIGN                                                   !1, 'Maximum+stack+depth+exceeded'
  12    18      > JMP                                                      ->29
  14    19    >   ASSIGN                                                   !1, 'Underflow+or+the+modes+mismatch'
  15    20      > JMP                                                      ->29
  17    21    >   ASSIGN                                                   !1, 'Unexpected+control+character+found'
  18    22      > JMP                                                      ->29
  20    23    >   ASSIGN                                                   !1, 'Syntax+error%2C+malformed+JSON'
  21    24      > JMP                                                      ->29
  23    25    >   ASSIGN                                                   !1, 'Malformed+UTF-8+characters%2C+possibly+incorrectly+encoded'
  24    26      > JMP                                                      ->29
  26    27    >   ASSIGN                                                   !1, 'Unknown+error'
  27    28      > JMP                                                      ->29
        29    >   FREE                                                     $4
  30    30        INIT_FCALL                                               'var_dump'
        31        SEND_VAR                                                 !1
        32        DO_ICALL                                                 
        33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0