3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = 'invalid json test'; try { $array = json_decode($json, true, 512, JSON_THROW_ON_ERROR); printf('Valid JSON output: %s', print_r($array, true)); } catch (\JsonException $exception) { printf('Invalid JSON input: %s', print_r($exception, true)); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 17
Branch analysis from position: 17
2 jumps found. (Code = 107) Position 1 = 18, Position 2 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UhcjK
function name:  (null)
number of ops:  27
compiled vars:  !0 = $json, !1 = $array, !2 = $exception
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'invalid+json+test'
    6     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        SEND_VAL                                                 512
          5        SEND_VAL                                                 4194304
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
    7     8        INIT_FCALL                                               'printf'
          9        SEND_VAL                                                 'Valid+JSON+output%3A+%25s'
         10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
         16      > JMP                                                      ->26
    8    17  E > > CATCH                                       last         'JsonException'
    9    18    >   INIT_FCALL                                               'printf'
         19        SEND_VAL                                                 'Invalid+JSON+input%3A+%25s'
         20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !2
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $8      
         24        SEND_VAR                                                 $8
         25        DO_ICALL                                                 
   10    26    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.06 ms | 1395 KiB | 19 Q