3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = array( 'fruits' => [ 'apple' => 'value', 'orange' => 'value' ], 'vegetables' => [ 'onion' => 'value', 'carrot' => 'value' ]); $string = 'fruits[orange]'; $indexes = (preg_split( "/(\[|\])/", $string)); $first_index= $indexes[0]; $seconnd_index= $indexes[1]; if(isset($array[$first_index][$seconnd_index])) { echo "exist"; } else { echo "not exist"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vmNrQ
function name:  (null)
number of ops:  18
compiled vars:  !0 = $array, !1 = $string, !2 = $indexes, !3 = $first_index, !4 = $seconnd_index
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   13     1        ASSIGN                                                       !1, 'fruits%5Borange%5D'
   15     2        INIT_FCALL                                                   'preg_split'
          3        SEND_VAL                                                     '%2F%28%5C%5B%7C%5C%5D%29%2F'
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                             $7      
          6        ASSIGN                                                       !2, $7
   16     7        FETCH_DIM_R                                          ~9      !2, 0
          8        ASSIGN                                                       !3, ~9
   17     9        FETCH_DIM_R                                          ~11     !2, 1
         10        ASSIGN                                                       !4, ~11
   18    11        FETCH_DIM_IS                                         ~13     !0, !3
         12        ISSET_ISEMPTY_DIM_OBJ                             0          ~13, !4
         13      > JMPZ                                                         ~14, ->16
   20    14    >   ECHO                                                         'exist'
   18    15      > JMP                                                          ->17
   24    16    >   ECHO                                                         'not+exist'
   25    17    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.77 ms | 3269 KiB | 14 Q