3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo phpversion(); $str = '{ "key": "Hi!" }invalid'; $data = json_decode($str, true); if (JSON_ERROR_NONE === json_last_error()) { echo 'Invalid!'; } else { echo 'Valid'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nquiG
function name:  (null)
number of ops:  17
compiled vars:  !0 = $str, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'phpversion'
          1        DO_ICALL                                         $2      
          2        ECHO                                                     $2
    3     3        ASSIGN                                                   !0, '%7B+%22key%22%3A+%22Hi%21%22+%7Dinvalid'
    4     4        INIT_FCALL                                               'json_decode'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
    5     9        INIT_FCALL                                               'json_last_error'
         10        DO_ICALL                                         $6      
         11        IS_IDENTICAL                                             $6, 0
         12      > JMPZ                                                     ~7, ->15
    6    13    >   ECHO                                                     'Invalid%21'
         14      > JMP                                                      ->16
    8    15    >   ECHO                                                     'Valid'
    9    16    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.76 ms | 1395 KiB | 19 Q