3v4l.org

run code in 300+ PHP versions simultaneously
<?php function tep_get_subcategories($category_id) { $subcategories_raw = tep_db_query('SELECT ca.categories_id FROM categories ca LEFT JOIN categoreis cb ON ca.parent_id = cb.categories_id WHERE cb.categoreis_id = ' . (int) $category_id); $subcategories = array(); if (mysql_num_rows($subcategories_raw) >= 1) { while ($row = mysql_fetch_assoc($subcategories_raw)) { $category_id = $row['categories_id']; $subcategories[] = $category_id; } } return $subcategories; } function tep_get_leaf_categories($category_id) { $sub_categories = tep_get_subcategories($category_id); // no sub categories found:return self as result if (count($sub_categories) === 0) { return array($category_id); } else { foreach ($sub_categories as $category_id) { tep_get_leaf_categories($category_id); // what next? } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mGcMQ
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E > > RETURN                                                   1

Function tep_get_subcategories:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 23
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 14
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 14
Branch analysis from position: 23
Branch analysis from position: 14
Branch analysis from position: 23
filename:       /in/mGcMQ
function name:  tep_get_subcategories
number of ops:  25
compiled vars:  !0 = $category_id, !1 = $subcategories_raw, !2 = $subcategories, !3 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL_BY_NAME                                       'tep_db_query'
    7     2        CAST                                          4  ~4      !0
          3        CONCAT                                           ~5      'SELECT+ca.categories_id%0A%09%09%09%09%09%09%09FROM+categories+ca%0A%09%09%09%09%09%09%09LEFT+JOIN+categoreis+cb%0A%09%09%09%09%09%09%09%09ON+ca.parent_id+%3D+cb.categories_id%0A%09%09%09%09%09%09%09WHERE+cb.categoreis_id+%3D+', ~4
          4        SEND_VAL_EX                                              ~5
          5        DO_FCALL                                      0  $6      
    3     6        ASSIGN                                                   !1, $6
    9     7        ASSIGN                                                   !2, <array>
   10     8        INIT_FCALL_BY_NAME                                       'mysql_num_rows'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $9      
         11        IS_SMALLER_OR_EQUAL                                      1, $9
         12      > JMPZ                                                     ~10, ->23
   11    13    > > JMP                                                      ->18
   12    14    >   FETCH_DIM_R                                      ~11     !3, 'categories_id'
         15        ASSIGN                                                   !0, ~11
   13    16        ASSIGN_DIM                                               !2
         17        OP_DATA                                                  !0
   11    18    >   INIT_FCALL_BY_NAME                                       'mysql_fetch_assoc'
         19        SEND_VAR_EX                                              !1
         20        DO_FCALL                                      0  $14     
         21        ASSIGN                                           ~15     !3, $14
         22      > JMPNZ                                                    ~15, ->14
   17    23    > > RETURN                                                   !2
   18    24*     > RETURN                                                   null

End of function tep_get_subcategories

Function tep_get_leaf_categories:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/mGcMQ
function name:  tep_get_leaf_categories
number of ops:  19
compiled vars:  !0 = $category_id, !1 = $sub_categories
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        INIT_FCALL                                               'tep_get_subcategories'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !1, $2
   24     5        COUNT                                            ~4      !1
          6        IS_IDENTICAL                                             ~4, 0
          7      > JMPZ                                                     ~5, ->11
   25     8    >   INIT_ARRAY                                       ~6      !0
          9      > RETURN                                                   ~6
         10*       JMP                                                      ->18
   27    11    > > FE_RESET_R                                       $7      !1, ->17
         12    > > FE_FETCH_R                                               $7, !0, ->17
   28    13    >   INIT_FCALL_BY_NAME                                       'tep_get_leaf_categories'
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0          
   27    16      > JMP                                                      ->12
         17    >   FE_FREE                                                  $7
   32    18      > RETURN                                                   null

End of function tep_get_leaf_categories

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.54 ms | 1403 KiB | 14 Q