3v4l.org

run code in 500+ PHP versions simultaneously
<?php $full_cats= array( array("parent_cats" => array ( "id" => "384", "name" => "Beers &amp; Ales", "parent" => "0" ) ), array("parent_cats" => array ( "id" => "387", "name" => "Wines", "parent" => "0" ) )); $sub_cats=array( array("sub_cats" => array ( "id" => "386", "name" => "Ales", "parent" => "384" ) ), array("sub_cats" => array ( "id" => "385", "name" => "Beers", "parent" => "384" ) ), array("sub_cats" => array ( "id" => "403", "name" => "Red", "parent" => "387" ) )); $all = []; $tmpsubs = []; foreach ($full_cats as $parent) { $tmp = ['parent_cats' => $parent['parent_cats'], 'sub_cats' => []]; foreach ($sub_cats as $sub) { if ($sub['sub_cats']['parent'] == $parent['parent_cats']['id']) { $tmp['sub_cats'][]=$sub['sub_cats']; } } $all[] = $tmp; } var_export($all);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 27
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 27
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 23
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 23
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 23
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/01oLF
function name:  (null)
number of ops:  32
compiled vars:  !0 = $full_cats, !1 = $sub_cats, !2 = $all, !3 = $tmpsubs, !4 = $parent, !5 = $tmp, !6 = $sub
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   21     1        ASSIGN                                                       !1, <array>
   47     2        ASSIGN                                                       !2, <array>
   48     3        ASSIGN                                                       !3, <array>
   49     4      > FE_RESET_R                                           $11     !0, ->27
          5    > > FE_FETCH_R                                                   $11, !4, ->27
   50     6    >   FETCH_DIM_R                                          ~12     !4, 'parent_cats'
          7        INIT_ARRAY                                           ~13     ~12, 'parent_cats'
          8        ADD_ARRAY_ELEMENT                                    ~13     <array>, 'sub_cats'
          9        ASSIGN                                                       !5, ~13
   51    10      > FE_RESET_R                                           $15     !1, ->23
         11    > > FE_FETCH_R                                                   $15, !6, ->23
   52    12    >   FETCH_DIM_R                                          ~16     !6, 'sub_cats'
         13        FETCH_DIM_R                                          ~17     ~16, 'parent'
         14        FETCH_DIM_R                                          ~18     !4, 'parent_cats'
         15        FETCH_DIM_R                                          ~19     ~18, 'id'
         16        IS_EQUAL                                                     ~17, ~19
         17      > JMPZ                                                         ~20, ->22
   53    18    >   FETCH_DIM_R                                          ~23     !6, 'sub_cats'
         19        FETCH_DIM_W                                          $21     !5, 'sub_cats'
         20        ASSIGN_DIM                                                   $21
         21        OP_DATA                                                      ~23
   51    22    > > JMP                                                          ->11
         23    >   FE_FREE                                                      $15
   56    24        ASSIGN_DIM                                                   !2
         25        OP_DATA                                                      !5
   49    26      > JMP                                                          ->5
         27    >   FE_FREE                                                      $11
   58    28        INIT_FCALL                                                   'var_export'
         29        SEND_VAR                                                     !2
         30        DO_ICALL                                                     
         31      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
213.06 ms | 2121 KiB | 14 Q