3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.42 ms | 1394 KiB | 17 Q