3v4l.org

run code in 300+ PHP versions simultaneously
<?php $nodes = array(); $parents = array(); function fillCategory($s, $id, $parentId){ $p = strpos('/', $s); $s1 = substr($s, 0, $p); $s2 = substr($s, $p); if(empty($parentId)){ $parents[$s] = $id; }else{ $parentId = $parents[$s]; } $nodes[] = array($s1, $id, $parentId); $id += 1; if(isset($s2)){ fillCategory($s2, $id, $parentId); } } fillCategory('Мужчинам / Носки / Белые', 0, null); var_dump($nodes);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O5gGe
function name:  (null)
number of ops:  11
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        SEND_VAL                                                 0
          5        SEND_VAL                                                 null
          6        DO_FCALL                                      0          
   22     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function fillcategory:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 39
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 39
Branch analysis from position: 34
Branch analysis from position: 39
filename:       /in/O5gGe
function name:  fillCategory
number of ops:  40
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_VAR                                                 !0
         10        SEND_VAL                                                 0
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $10     
         13        ASSIGN                                                   !4, $10
    8    14        INIT_FCALL                                               'substr'
         15        SEND_VAR                                                 !0
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $12     
         18        ASSIGN                                                   !5, $12
    9    19        ISSET_ISEMPTY_CV                                         !2
         20      > JMPZ                                                     ~14, ->24
   10    21    >   ASSIGN_DIM                                               !6, !0
         22        OP_DATA                                                  !1
         23      > JMP                                                      ->26
   12    24    >   FETCH_DIM_R                                      ~16     !6, !0
         25        ASSIGN                                                   !2, ~16
   14    26    >   INIT_ARRAY                                       ~19     !4
         27        ADD_ARRAY_ELEMENT                                ~19     !1
         28        ADD_ARRAY_ELEMENT                                ~19     !2
         29        ASSIGN_DIM                                               !7
         30        OP_DATA                                                  ~19
   15    31        ASSIGN_OP                                     1          !1, 1
   16    32        ISSET_ISEMPTY_CV                                         !5
         33      > JMPZ                                                     ~21, ->39
   17    34    >   INIT_FCALL_BY_NAME                                       'fillCategory'
         35        SEND_VAR_EX                                              !5
         36        SEND_VAR_EX                                              !1
         37        SEND_VAR_EX                                              !2
         38        DO_FCALL                                      0          
   19    39    > > RETURN                                                   null

End of function fillcategory

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
215.11 ms | 1403 KiB | 20 Q