3v4l.org

run code in 300+ PHP versions simultaneously
<?php // A valid json string $json[] = '{"Organization": "PHP Documentation Team"}'; // An invalid json string which will cause an syntax // error, in this case we used ' instead of " for quotation $json[] = "{'Organization': 'PHP Documentation Team'}"; foreach ($json as $string) { echo 'Decoding: ' . $string; json_decode($string); switch (json_last_error()) { case JSON_ERROR_NONE: echo ' - No errors'; break; case JSON_ERROR_DEPTH: echo ' - Maximum stack depth exceeded'; break; case JSON_ERROR_STATE_MISMATCH: echo ' - Underflow or the modes mismatch'; break; case JSON_ERROR_CTRL_CHAR: echo ' - Unexpected control character found'; break; case JSON_ERROR_SYNTAX: echo ' - Syntax error, malformed JSON'; break; case JSON_ERROR_UTF8: echo ' - Malformed UTF-8 characters, possibly incorrectly encoded'; break; default: echo ' - Unknown error'; break; } echo PHP_EOL; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 44
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 44
Branch analysis from position: 6
8 jumps found. (Code = 187) Position 1 = 27, Position 2 = 29, Position 3 = 31, Position 4 = 33, Position 5 = 35, Position 6 = 37, Position 7 = 39, Position 8 = 14
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 27
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 29
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 31
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 33
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 35
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 37
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 37
Branch analysis from position: 35
Branch analysis from position: 33
Branch analysis from position: 31
Branch analysis from position: 29
Branch analysis from position: 27
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
filename:       /in/EqbZ8
function name:  (null)
number of ops:  46
compiled vars:  !0 = $json, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_DIM                                               !0
          1        OP_DATA                                                  '%7B%22Organization%22%3A+%22PHP+Documentation+Team%22%7D'
    7     2        ASSIGN_DIM                                               !0
          3        OP_DATA                                                  '%7B%27Organization%27%3A+%27PHP+Documentation+Team%27%7D'
   10     4      > FE_RESET_R                                       $4      !0, ->44
          5    > > FE_FETCH_R                                               $4, !1, ->44
   11     6    >   CONCAT                                           ~5      'Decoding%3A+', !1
          7        ECHO                                                     ~5
   12     8        INIT_FCALL                                               'json_decode'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
   14    11        INIT_FCALL                                               'json_last_error'
         12        DO_ICALL                                         $7      
         13      > SWITCH_LONG                                              $7, [ 0:->27, 1:->29, 2:->31, 3:->33, 4:->35, 5:->37, ], ->39
         14    >   CASE                                                     $7, 0
         15      > JMPNZ                                                    ~8, ->27
         16    >   CASE                                                     $7, 1
         17      > JMPNZ                                                    ~8, ->29
         18    >   CASE                                                     $7, 2
         19      > JMPNZ                                                    ~8, ->31
         20    >   CASE                                                     $7, 3
         21      > JMPNZ                                                    ~8, ->33
         22    >   CASE                                                     $7, 4
         23      > JMPNZ                                                    ~8, ->35
         24    >   CASE                                                     $7, 5
         25      > JMPNZ                                                    ~8, ->37
         26    > > JMP                                                      ->39
   16    27    >   ECHO                                                     '+-+No+errors'
   17    28      > JMP                                                      ->41
   19    29    >   ECHO                                                     '+-+Maximum+stack+depth+exceeded'
   20    30      > JMP                                                      ->41
   22    31    >   ECHO                                                     '+-+Underflow+or+the+modes+mismatch'
   23    32      > JMP                                                      ->41
   25    33    >   ECHO                                                     '+-+Unexpected+control+character+found'
   26    34      > JMP                                                      ->41
   28    35    >   ECHO                                                     '+-+Syntax+error%2C+malformed+JSON'
   29    36      > JMP                                                      ->41
   31    37    >   ECHO                                                     '+-+Malformed+UTF-8+characters%2C+possibly+incorrectly+encoded'
   32    38      > JMP                                                      ->41
   34    39    >   ECHO                                                     '+-+Unknown+error'
   35    40      > JMP                                                      ->41
         41    >   FREE                                                     $7
   38    42        ECHO                                                     '%0A'
   10    43      > JMP                                                      ->5
         44    >   FE_FREE                                                  $4
   40    45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.25 ms | 1392 KiB | 17 Q