3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '46-sen1-Grid1-138', '47-sen2-Grid1-138', '50-sen5-Grid2-144', '51-sen6-Grid2-144' ]; $result = []; foreach ($array as $v) { [1 => $k, 0 => $result[$k][]] = preg_split('/-Grid\d+-/', $v); } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/Kkk2H
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array, !1 = $result, !2 = $v, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   11     2      > FE_RESET_R                                       $6      !0, ->16
          3    > > FE_FETCH_R                                               $6, !2, ->16
   12     4    >   INIT_FCALL                                               'preg_split'
          5        SEND_VAL                                                 '%2F-Grid%5Cd%2B-%2F'
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $7      
          8        FETCH_LIST_R                                     $8      $7, 1
          9        ASSIGN                                                   !3, $8
         10        FETCH_LIST_R                                     $10     $7, 0
         11        FETCH_DIM_W                                      $11     !1, !3
         12        ASSIGN_DIM                                               $11
         13        OP_DATA                                                  $10
         14        FREE                                                     $7
   11    15      > JMP                                                      ->3
         16    >   FE_FREE                                                  $6
   14    17        INIT_FCALL                                               'var_export'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.58 ms | 1011 KiB | 15 Q