3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'key_1' => 'FOO', 'key_2' => 'FTU-1', 'cats' => '/30/' ], [ 'key_1' => 'FOO', 'key_2' => 'FTU-2', 'cats' => '/30/' ], [ 'key_1' => 'FOO', 'key_2' => 'FTU-3', 'cats' => '/30/10/' ], [ 'key_1' => 'FOO', 'key_2' => 'FTU-4', 'cats' => '/15/' ], [ 'key_1' => 'FOO', 'key_2' => 'FTU-5', 'cats' => '/10/' ], [ 'key_1' => 'FOO', 'key_2' => 'FTU-6', 'cats' => '/15/' ], ]; $result = []; foreach ($array as $row) { $cats = preg_split('#/#', $row['cats'], 0, PREG_SPLIT_NO_EMPTY); foreach ($cats as $cat) { $result[$cat][] = $row; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 20
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/pMZ5N
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array, !1 = $result, !2 = $row, !3 = $cats, !4 = $cat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   36     1        ASSIGN                                                   !1, <array>
   37     2      > FE_RESET_R                                       $7      !0, ->20
          3    > > FE_FETCH_R                                               $7, !2, ->20
   38     4    >   INIT_FCALL                                               'preg_split'
          5        SEND_VAL                                                 '%23%2F%23'
          6        FETCH_DIM_R                                      ~8      !2, 'cats'
          7        SEND_VAL                                                 ~8
          8        SEND_VAL                                                 0
          9        SEND_VAL                                                 1
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !3, $9
   39    12      > FE_RESET_R                                       $11     !3, ->18
         13    > > FE_FETCH_R                                               $11, !4, ->18
   40    14    >   FETCH_DIM_W                                      $12     !1, !4
         15        ASSIGN_DIM                                               $12
         16        OP_DATA                                                  !2
   39    17      > JMP                                                      ->13
         18    >   FE_FREE                                                  $11
   37    19      > JMP                                                      ->3
         20    >   FE_FREE                                                  $7
   43    21        INIT_FCALL                                               'var_export'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.57 ms | 1012 KiB | 15 Q