3v4l.org

run code in 300+ PHP versions simultaneously
<?php $nodes = array(); $parents = array(); function fillCategory($s, $id, $parentId){ $p = strpos('/', $s); $s1 = substr(0, $p); $s2 = substr($p); if(empty($parentId)){ $parents[$s] = $id; }else{ $parentId = $parents[$s]; } $nodes[] = array($s, $id, $parentId); $id += 1; if(isset($s2)){ fillCategory($s, $id, $parentId); } } fillCategory('Мужчинам / Носки / Белые'); var_dump($nodes);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f2H9N
function name:  (null)
number of ops:  9
compiled vars:  !0 = $nodes, !1 = $parents
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
   21     2        INIT_FCALL                                               'fillcategory'
          3        SEND_VAL                                                 '%D0%9C%D1%83%D0%B6%D1%87%D0%B8%D0%BD%D0%B0%D0%BC+%2F+%D0%9D%D0%BE%D1%81%D0%BA%D0%B8+%2F+%D0%91%D0%B5%D0%BB%D1%8B%D0%B5'
          4        DO_FCALL                                      0          
   22     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function fillcategory:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 37
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 37
Branch analysis from position: 32
Branch analysis from position: 37
filename:       /in/f2H9N
function name:  fillCategory
number of ops:  38
compiled vars:  !0 = $s, !1 = $id, !2 = $parentId, !3 = $p, !4 = $s1, !5 = $s2, !6 = $parents, !7 = $nodes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    6     3        INIT_FCALL                                               'strpos'
          4        SEND_VAL                                                 '%2F'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !3, $8
    7     8        INIT_FCALL                                               'substr'
          9        SEND_VAL                                                 0
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $10     
         12        ASSIGN                                                   !4, $10
    8    13        INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $12     
         16        ASSIGN                                                   !5, $12
    9    17        ISSET_ISEMPTY_CV                                         !2
         18      > JMPZ                                                     ~14, ->22
   10    19    >   ASSIGN_DIM                                               !6, !0
         20        OP_DATA                                                  !1
         21      > JMP                                                      ->24
   12    22    >   FETCH_DIM_R                                      ~16     !6, !0
         23        ASSIGN                                                   !2, ~16
   14    24    >   INIT_ARRAY                                       ~19     !0
         25        ADD_ARRAY_ELEMENT                                ~19     !1
         26        ADD_ARRAY_ELEMENT                                ~19     !2
         27        ASSIGN_DIM                                               !7
         28        OP_DATA                                                  ~19
   15    29        ASSIGN_OP                                     1          !1, 1
   16    30        ISSET_ISEMPTY_CV                                         !5
         31      > JMPZ                                                     ~21, ->37
   17    32    >   INIT_FCALL_BY_NAME                                       'fillCategory'
         33        SEND_VAR_EX                                              !0
         34        SEND_VAR_EX                                              !1
         35        SEND_VAR_EX                                              !2
         36        DO_FCALL                                      0          
   19    37    > > RETURN                                                   null

End of function fillcategory

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.9 ms | 1403 KiB | 20 Q