3v4l.org

run code in 300+ PHP versions simultaneously
<?php $selectors = array('plants', 'fruits', 'apple'); $list = array( 'plants' => array( 'fruits' => array( 'apple' => 'sweet', 'orange' => 'sweet', 'pear' => 'tart' ) ) ); $select = $list; foreach ($selectors as $selector) { if (isset($select[$selector])) { $select = $select[$selector]; } else { exit("Error: '$selector' not found"); } } echo $select;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 10
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/4KYiP
function name:  (null)
number of ops:  18
compiled vars:  !0 = $selectors, !1 = $list, !2 = $select, !3 = $selector
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
   15     2        ASSIGN                                                   !2, !1
   16     3      > FE_RESET_R                                       $7      !0, ->15
          4    > > FE_FETCH_R                                               $7, !3, ->15
   17     5    >   ISSET_ISEMPTY_DIM_OBJ                         0          !2, !3
          6      > JMPZ                                                     ~8, ->10
   18     7    >   FETCH_DIM_R                                      ~9      !2, !3
          8        ASSIGN                                                   !2, ~9
          9      > JMP                                                      ->14
   20    10    >   ROPE_INIT                                     3  ~12     'Error%3A+%27'
         11        ROPE_ADD                                      1  ~12     ~12, !3
         12        ROPE_END                                      2  ~11     ~12, '%27+not+found'
         13      > EXIT                                                     ~11
   16    14    > > JMP                                                      ->4
         15    >   FE_FREE                                                  $7
   24    16        ECHO                                                     !2
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.36 ms | 1398 KiB | 13 Q