3v4l.org

run code in 500+ PHP versions simultaneously
<?php $j[] = 'ma_1_49812_5318.jpg'; $j[] = 'ma_1_49812_5319.jpg'; $j[] = 'ma_1_49813_5320.jpg'; $j[] = 'ma_1_49813_5321.jpg'; $result = []; foreach ($j as $filename) { $groupBy = preg_replace('/_[^_]+$/', '', $filename); if (!isset($ref[$groupBy])) { $ref[$groupBy] = $filename; $result[] = &$ref[$groupBy]; } else { $ref[$groupBy] .= "|$filename"; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 29
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 29
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 24
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/TBbUF
function name:  (null)
number of ops:  34
compiled vars:  !0 = $j, !1 = $result, !2 = $filename, !3 = $groupBy, !4 = $ref
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_DIM                                                   !0
          1        OP_DATA                                                      'ma_1_49812_5318.jpg'
    4     2        ASSIGN_DIM                                                   !0
          3        OP_DATA                                                      'ma_1_49812_5319.jpg'
    5     4        ASSIGN_DIM                                                   !0
          5        OP_DATA                                                      'ma_1_49813_5320.jpg'
    6     6        ASSIGN_DIM                                                   !0
          7        OP_DATA                                                      'ma_1_49813_5321.jpg'
    8     8        ASSIGN                                                       !1, <array>
    9     9      > FE_RESET_R                                           $10     !0, ->29
         10    > > FE_FETCH_R                                                   $10, !2, ->29
   10    11    >   FRAMELESS_ICALL_3                preg_replace        ~11     '%2F_%5B%5E_%5D%2B%24%2F', ''
         12        OP_DATA                                                      !2
         13        ASSIGN                                                       !3, ~11
   11    14        ISSET_ISEMPTY_DIM_OBJ                             0  ~13     !4, !3
         15        BOOL_NOT                                             ~14     ~13
         16      > JMPZ                                                         ~14, ->24
   12    17    >   ASSIGN_DIM                                                   !4, !3
         18        OP_DATA                                                      !2
   13    19        FETCH_DIM_W                                          $17     !4, !3
         20        MAKE_REF                                             $18     $17
         21        FETCH_DIM_W                                          $16     !1
         22        ASSIGN_REF                                                   $16, $18
   11    23      > JMP                                                          ->28
   15    24    >   NOP                                                          
         25        FAST_CONCAT                                          ~21     '%7C', !2
         26        ASSIGN_DIM_OP                    .=               8          !4, !3
         27        OP_DATA                                                      ~21
    9    28    > > JMP                                                          ->10
         29    >   FE_FREE                                                      $10
   18    30        INIT_FCALL                                                   'var_export'
         31        SEND_VAR                                                     !1
         32        DO_ICALL                                                     
         33      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.1 ms | 1728 KiB | 14 Q