3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['Adams', 'King Street 12', '14:25', 'Heart Attack'], ['Ellis', 'Vine Street 4', '02:48', 'Broken Leg'], ['Adams', 'Parker Street 43', '20:10', 'Heart Attack'], ['Neil', 'Jack Street 9', '12:25', 'Broken Heart'], ['Colin', 'Queen Street 18', '05:48', 'Restless Leg'], ['Artemis', 'First Street 1', '10:17', 'Broken Leg'], ['Rufus', 'Long Street 5', '11:11', 'Dog Attack'], ]; $result = []; foreach ($array as $row) { if (isset($result[$row[3]])) { $result[$row[3]][] = $row; } elseif (isset($first[$row[3]])) { $result[$row[3]] = [$first[$row[3]], $row]; } else { $first[$row[3]] = $row; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 27
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 27
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/seLQX
function name:  (null)
number of ops:  32
compiled vars:  !0 = $array, !1 = $result, !2 = $row, !3 = $first
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   14     2      > FE_RESET_R                                       $6      !0, ->27
          3    > > FE_FETCH_R                                               $6, !2, ->27
   15     4    >   FETCH_DIM_R                                      ~7      !2, 3
          5        ISSET_ISEMPTY_DIM_OBJ                         0          !1, ~7
          6      > JMPZ                                                     ~8, ->12
   16     7    >   FETCH_DIM_R                                      ~9      !2, 3
          8        FETCH_DIM_W                                      $10     !1, ~9
          9        ASSIGN_DIM                                               $10
         10        OP_DATA                                                  !2
   15    11      > JMP                                                      ->26
   17    12    >   FETCH_DIM_R                                      ~12     !2, 3
         13        ISSET_ISEMPTY_DIM_OBJ                         0          !3, ~12
         14      > JMPZ                                                     ~13, ->23
   18    15    >   FETCH_DIM_R                                      ~14     !2, 3
         16        FETCH_DIM_R                                      ~16     !2, 3
         17        FETCH_DIM_R                                      ~17     !3, ~16
         18        INIT_ARRAY                                       ~18     ~17
         19        ADD_ARRAY_ELEMENT                                ~18     !2
         20        ASSIGN_DIM                                               !1, ~14
         21        OP_DATA                                                  ~18
   17    22      > JMP                                                      ->26
   20    23    >   FETCH_DIM_R                                      ~19     !2, 3
         24        ASSIGN_DIM                                               !3, ~19
         25        OP_DATA                                                  !2
   14    26    > > JMP                                                      ->3
         27    >   FE_FREE                                                  $6
   23    28        INIT_FCALL                                               'var_export'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.98 ms | 1011 KiB | 14 Q