3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pages = array(); $pages[1] = array('id' => 1, 'parent' => 0, 'name' => 'Hello World'); $pages[2] = array('id' => 1, 'parent' => 1, 'name' => 'Child of Hello World'); $pages[3] = array('id' => 1, 'parent' => 0, 'name' => 'Brother of Hello World'); $pages[4] = array('id' => 4, 'parent' => 2, 'name' => 'Grand-child of Hello World'); $pages[6] = array('id' => 6, 'parent' => 4, 'name' => 'Great-grand-child of Hello World'); $children = array(); foreach($pages as $key => $page){ $parent = (int)$page['parent']; if(!isset($children[$parent])){ $children[$parent] = array(); $children[$parent][$key] = array('id' => $page['id'], 'name' => $page['name']); } } var_dump($children);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 31
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 31
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 30
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 30
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/bGUIf
function name:  (null)
number of ops:  36
compiled vars:  !0 = $pages, !1 = $children, !2 = $page, !3 = $key, !4 = $parent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     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, 6
         10        OP_DATA                                                  <array>
   10    11        ASSIGN                                                   !1, <array>
   11    12      > FE_RESET_R                                       $12     !0, ->31
         13    > > FE_FETCH_R                                       ~13     $12, !2, ->31
         14    >   ASSIGN                                                   !3, ~13
   12    15        FETCH_DIM_R                                      ~15     !2, 'parent'
         16        CAST                                          4  ~16     ~15
         17        ASSIGN                                                   !4, ~16
   13    18        ISSET_ISEMPTY_DIM_OBJ                         0  ~18     !1, !4
         19        BOOL_NOT                                         ~19     ~18
         20      > JMPZ                                                     ~19, ->30
   14    21    >   ASSIGN_DIM                                               !1, !4
         22        OP_DATA                                                  <array>
   15    23        FETCH_DIM_R                                      ~23     !2, 'id'
         24        INIT_ARRAY                                       ~24     ~23, 'id'
         25        FETCH_DIM_R                                      ~25     !2, 'name'
         26        ADD_ARRAY_ELEMENT                                ~24     ~25, 'name'
         27        FETCH_DIM_W                                      $21     !1, !4
         28        ASSIGN_DIM                                               $21, !3
         29        OP_DATA                                                  ~24
   11    30    > > JMP                                                      ->13
         31    >   FE_FREE                                                  $12
   19    32        INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !1
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.51 ms | 1401 KiB | 15 Q