3v4l.org

run code in 300+ PHP versions simultaneously
<?php $selector = 'foo[bar][foo]'; $input = array('foo' => array('bar' => array('foo' => 'poop'))); $value = $input; $path = explode('[', str_replace(']', '', $selector)); foreach ($this->selector_path as $name) { if (array_key_exists($name, $value)) { $value = $value[$name]; } else { $value = null; break; } } var_dump($value);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 25
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
Branch analysis from position: 25
filename:       /in/Nsvvc
function name:  (null)
number of ops:  30
compiled vars:  !0 = $selector, !1 = $input, !2 = $value, !3 = $path, !4 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'foo%5Bbar%5D%5Bfoo%5D'
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, !1
    8     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '%5B'
          5        INIT_FCALL                                               'str_replace'
          6        SEND_VAL                                                 '%5D'
          7        SEND_VAL                                                 ''
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $8      
         10        SEND_VAR                                                 $8
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !3, $9
   10    13        FETCH_THIS                                       $11     
         14        FETCH_OBJ_R                                      ~12     $11, 'selector_path'
         15      > FE_RESET_R                                       $13     ~12, ->25
         16    > > FE_FETCH_R                                               $13, !4, ->25
   11    17    >   ARRAY_KEY_EXISTS                                         !4, !2
         18      > JMPZ                                                     ~14, ->22
   12    19    >   FETCH_DIM_R                                      ~15     !2, !4
         20        ASSIGN                                                   !2, ~15
         21      > JMP                                                      ->24
   14    22    >   ASSIGN                                                   !2, null
   16    23      > JMP                                                      ->25
   10    24    > > JMP                                                      ->16
         25    >   FE_FREE                                                  $13
   20    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.97 ms | 1400 KiB | 19 Q