3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a=array(); if(empty($a)) echo 'empty'; // 一个有效的 json 字符串 $json [] = '{"Organization": "PHP Documentation Team"}' ; // 一个无效的 json 字符串会导致一个语法错误,在这个例子里我们使用 ' 代替了 " 作为引号 $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 = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 48
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 48
Branch analysis from position: 10
8 jumps found. (Code = 187) Position 1 = 31, Position 2 = 33, Position 3 = 35, Position 4 = 37, Position 5 = 39, Position 6 = 41, Position 7 = 43, Position 8 = 18
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
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
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 39
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 41
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 41
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: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
Branch analysis from position: 4
filename:       /in/BUNY5
function name:  (null)
number of ops:  50
compiled vars:  !0 = $a, !1 = $json, !2 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ISSET_ISEMPTY_CV                                         !0
          2      > JMPZ                                                     ~4, ->4
          3    >   ECHO                                                     'empty'
    5     4    >   ASSIGN_DIM                                               !1
          5        OP_DATA                                                  '%7B%22Organization%22%3A+%22PHP+Documentation+Team%22%7D'
    8     6        ASSIGN_DIM                                               !1
          7        OP_DATA                                                  '%7B%27Organization%27%3A+%27PHP+Documentation+Team%27%7D'
   11     8      > FE_RESET_R                                       $7      !1, ->48
          9    > > FE_FETCH_R                                               $7, !2, ->48
   12    10    >   CONCAT                                           ~8      'Decoding%3A+', !2
         11        ECHO                                                     ~8
   13    12        INIT_FCALL                                               'json_decode'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
   15    15        INIT_FCALL                                               'json_last_error'
         16        DO_ICALL                                         $10     
         17      > SWITCH_LONG                                              $10, [ 0:->31, 1:->33, 2:->35, 3:->37, 4:->39, 5:->41, ], ->43
         18    >   CASE                                                     $10, 0
         19      > JMPNZ                                                    ~11, ->31
         20    >   CASE                                                     $10, 1
         21      > JMPNZ                                                    ~11, ->33
         22    >   CASE                                                     $10, 2
         23      > JMPNZ                                                    ~11, ->35
         24    >   CASE                                                     $10, 3
         25      > JMPNZ                                                    ~11, ->37
         26    >   CASE                                                     $10, 4
         27      > JMPNZ                                                    ~11, ->39
         28    >   CASE                                                     $10, 5
         29      > JMPNZ                                                    ~11, ->41
         30    > > JMP                                                      ->43
   17    31    >   ECHO                                                     '+-+No+errors'
   18    32      > JMP                                                      ->45
   20    33    >   ECHO                                                     '+-+Maximum+stack+depth+exceeded'
   21    34      > JMP                                                      ->45
   23    35    >   ECHO                                                     '+-+Underflow+or+the+modes+mismatch'
   24    36      > JMP                                                      ->45
   26    37    >   ECHO                                                     '+-+Unexpected+control+character+found'
   27    38      > JMP                                                      ->45
   29    39    >   ECHO                                                     '+-+Syntax+error%2C+malformed+JSON'
   30    40      > JMP                                                      ->45
   32    41    >   ECHO                                                     '+-+Malformed+UTF-8+characters%2C+possibly+incorrectly+encoded'
   33    42      > JMP                                                      ->45
   35    43    >   ECHO                                                     '+-+Unknown+error'
   36    44      > JMP                                                      ->45
         45    >   FREE                                                     $10
   39    46        ECHO                                                     '%0A'
   11    47      > JMP                                                      ->9
         48    >   FE_FREE                                                  $7
   40    49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.83 ms | 1400 KiB | 17 Q