3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rows = array(array(1, 'Ana Sayfa', '#', 0, 1), array(2, 'Tutorials', '#', 0, 1), array(3, 'Java', 'java', 6, 1), array(4, 'Liferay', 'liferay', 3, 1), array(5, 'Frameworks', '#', 0, 1), array(6, 'JSF', 'jsf', 5, 1), array(7, 'Struts', 'struts', 5, 1), array(8, 'Spring', 'spring', 6, 1), array(9, 'Hibernate', 'hibernate', 6, 1), array(10, 'Webservices', '#', 0, 1), array(11, 'REST', 'rest', 10, 1), array(12, 'SOAP', 'soap', 10, 1), array(13, 'Contact', 'contact', 0, 1), array(14, 'About', 'about', 0, 1), array(15, 'TEST-TEST-TEST', 'test', 5, 1), array(16, 'TEST2', 'test2', 15, 1)); foreach ($rows as $row) { $items[] = array_combine(array('cat_id', 'cat_name', 'seo_url', 'parent_id', 'place'), $row); } function draw_menu($items, $parent_id) { echo "\n<ul>\n"; foreach ($items as $item) { if ($item['parent_id'] == $parent_id) { echo "<li>" . $item['cat_name']; // any children? if (count(array_keys(array_column($items, 'parent_id'), $item['cat_id']))) { draw_menu($items, $item['cat_id']); } echo "</li>\n"; } } echo "</ul>\n"; } draw_menu($items, 0);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/TT7nb
function name:  (null)
number of ops:  16
compiled vars:  !0 = $rows, !1 = $row, !2 = $items
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   19     1      > FE_RESET_R                                       $4      !0, ->10
          2    > > FE_FETCH_R                                               $4, !1, ->10
   20     3    >   INIT_FCALL                                               'array_combine'
          4        SEND_VAL                                                 <array>
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $6      
          7        ASSIGN_DIM                                               !2
          8        OP_DATA                                                  $6
   19     9      > JMP                                                      ->2
         10    >   FE_FREE                                                  $4
   38    11        INIT_FCALL                                               'draw_menu'
         12        SEND_VAR                                                 !2
         13        SEND_VAL                                                 0
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Function draw_menu:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 30
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 30
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 29
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 28
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 28
Branch analysis from position: 29
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/TT7nb
function name:  draw_menu
number of ops:  33
compiled vars:  !0 = $items, !1 = $parent_id, !2 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        ECHO                                                     '%0A%3Cul%3E%0A'
   25     3      > FE_RESET_R                                       $3      !0, ->30
          4    > > FE_FETCH_R                                               $3, !2, ->30
   26     5    >   FETCH_DIM_R                                      ~4      !2, 'parent_id'
          6        IS_EQUAL                                                 !1, ~4
          7      > JMPZ                                                     ~5, ->29
   27     8    >   FETCH_DIM_R                                      ~6      !2, 'cat_name'
          9        CONCAT                                           ~7      '%3Cli%3E', ~6
         10        ECHO                                                     ~7
   29    11        INIT_FCALL                                               'array_keys'
         12        INIT_FCALL                                               'array_column'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 'parent_id'
         15        DO_ICALL                                         $8      
         16        SEND_VAR                                                 $8
         17        FETCH_DIM_R                                      ~9      !2, 'cat_id'
         18        SEND_VAL                                                 ~9
         19        DO_ICALL                                         $10     
         20        COUNT                                            ~11     $10
         21      > JMPZ                                                     ~11, ->28
   30    22    >   INIT_FCALL_BY_NAME                                       'draw_menu'
         23        SEND_VAR_EX                                              !0
         24        CHECK_FUNC_ARG                                           
         25        FETCH_DIM_FUNC_ARG                               $12     !2, 'cat_id'
         26        SEND_FUNC_ARG                                            $12
         27        DO_FCALL                                      0          
   32    28    >   ECHO                                                     '%3C%2Fli%3E%0A'
   25    29    > > JMP                                                      ->4
         30    >   FE_FREE                                                  $3
   35    31        ECHO                                                     '%3C%2Ful%3E%0A'
   36    32      > RETURN                                                   null

End of function draw_menu

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.66 ms | 1011 KiB | 17 Q