3v4l.org

run code in 300+ PHP versions simultaneously
<?php $somearray = array( 'item1' => array( 'subitem1' => 'Some value', 'subitem2' => 'Some other value', 'subitem3' => array( 'subsubitem' => 'A sub value' ) ), 'item2' => 'a different value' ); $map = "item1/subitem3/subsubitem"; $parts = explode("/", $map); $currentData = $somearray; for ($i = 0; $i < count($parts); $i++) { $currentData = $currentData[$parts[$i]]; } $result = $currentData; echo $result;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
Branch analysis from position: 10
filename:       /in/l4dU1
function name:  (null)
number of ops:  20
compiled vars:  !0 = $somearray, !1 = $map, !2 = $parts, !3 = $currentData, !4 = $i, !5 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   16     1        ASSIGN                                                   !1, 'item1%2Fsubitem3%2Fsubsubitem'
   18     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%2F'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !2, $8
   20     7        ASSIGN                                                   !3, !0
   21     8        ASSIGN                                                   !4, 0
          9      > JMP                                                      ->14
   22    10    >   FETCH_DIM_R                                      ~12     !2, !4
         11        FETCH_DIM_R                                      ~13     !3, ~12
         12        ASSIGN                                                   !3, ~13
   21    13        PRE_INC                                                  !4
         14    >   COUNT                                            ~16     !2
         15        IS_SMALLER                                               !4, ~16
         16      > JMPNZ                                                    ~17, ->10
   25    17    >   ASSIGN                                                   !5, !3
   27    18        ECHO                                                     !5
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.37 ms | 1395 KiB | 15 Q