3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr_input = array(); $arr_input[1] = array("parent_id"=>"null", "name"=>"one"); $arr_input[2] = array("parent_id"=>"1", "name"=>"two"); $arr_input[3] = array("parent_id"=>"null", "name"=>"three"); $arr_input[4] = array("parent_id"=>"3", "name"=>"four"); $arr_input[5] = array("parent_id"=>"4", "name"=>"five"); $arr_input[6] = array("parent_id"=>"2", "name"=>"six"); $arr_input[7] = array("parent_id"=>"3", "name"=>"seven"); $arr_input[8] = array("parent_id"=>"2", "name"=>"eight"); $input_id = 6; // variable input if(isset($arr_input[$input_id])) { echo $arr_input[$input_id]['name']; $parent_id = $arr_input[$input_id]['parent_id']; while($parent_id!='null') { if(isset($arr_input[$parent_id])) { echo "/".$arr_input[$parent_id]['name']; } $parent_id = $arr_input[$parent_id]['parent_id']; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 38
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 27
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 33
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 27
Branch analysis from position: 38
Branch analysis from position: 27
Branch analysis from position: 33
Branch analysis from position: 38
filename:       /in/ur1r3
function name:  (null)
number of ops:  39
compiled vars:  !0 = $arr_input, !1 = $input_id, !2 = $parent_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN_DIM                                               !0, 1
          2        OP_DATA                                                  <array>
    5     3        ASSIGN_DIM                                               !0, 2
          4        OP_DATA                                                  <array>
    6     5        ASSIGN_DIM                                               !0, 3
          6        OP_DATA                                                  <array>
    7     7        ASSIGN_DIM                                               !0, 4
          8        OP_DATA                                                  <array>
    8     9        ASSIGN_DIM                                               !0, 5
         10        OP_DATA                                                  <array>
    9    11        ASSIGN_DIM                                               !0, 6
         12        OP_DATA                                                  <array>
   10    13        ASSIGN_DIM                                               !0, 7
         14        OP_DATA                                                  <array>
   11    15        ASSIGN_DIM                                               !0, 8
         16        OP_DATA                                                  <array>
   13    17        ASSIGN                                                   !1, 6
   15    18        ISSET_ISEMPTY_DIM_OBJ                         0          !0, !1
         19      > JMPZ                                                     ~13, ->38
   18    20    >   FETCH_DIM_R                                      ~14     !0, !1
         21        FETCH_DIM_R                                      ~15     ~14, 'name'
         22        ECHO                                                     ~15
   19    23        FETCH_DIM_R                                      ~16     !0, !1
         24        FETCH_DIM_R                                      ~17     ~16, 'parent_id'
         25        ASSIGN                                                   !2, ~17
   20    26      > JMP                                                      ->36
   22    27    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !2
         28      > JMPZ                                                     ~19, ->33
   24    29    >   FETCH_DIM_R                                      ~20     !0, !2
         30        FETCH_DIM_R                                      ~21     ~20, 'name'
         31        CONCAT                                           ~22     '%2F', ~21
         32        ECHO                                                     ~22
   26    33    >   FETCH_DIM_R                                      ~23     !0, !2
         34        FETCH_DIM_R                                      ~24     ~23, 'parent_id'
         35        ASSIGN                                                   !2, ~24
   20    36    >   IS_NOT_EQUAL                                             !2, 'null'
         37      > JMPNZ                                                    ~26, ->27
   28    38    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.03 ms | 1399 KiB | 13 Q