3v4l.org

run code in 300+ PHP versions simultaneously
<?php $users = [ ['first_name' => 'Bob', 'last_name' => 'Smith'], ['first_name' => 'Steve', 'last_name' => 'Little'], ['first_name' => 'Eric', 'last_name' => 'Fielder'], ['first_name' => 'Steve', 'last_name' => 'Richardson'], ['first_name' => 'Sue', 'last_name' => 'Boy'], ['first_name' => 'Bob', 'last_name' => 'Sanders'], ['first_name' => 'Bob', 'last_name' => 'Sanders'], ['first_name' => 'Bob', 'last_name' => 'Smith'], ]; foreach ($users as $row) { $grouped[$row['first_name']][$row['last_name'][0] ?? ''][$row['last_name']][] = $row; } var_export($grouped); /* foreach ($grouped as $firstName => $leadingLetterGroup) { if () */
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 15
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/FDNaF
function name:  (null)
number of ops:  20
compiled vars:  !0 = $users, !1 = $row, !2 = $grouped
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1      > FE_RESET_R                                       $4      !0, ->15
          2    > > FE_FETCH_R                                               $4, !1, ->15
   15     3    >   FETCH_DIM_R                                      ~5      !1, 'first_name'
          4        FETCH_DIM_IS                                     ~7      !1, 'last_name'
          5        FETCH_DIM_IS                                     ~8      ~7, 0
          6        COALESCE                                         ~9      ~8
          7        QM_ASSIGN                                        ~9      ''
          8        FETCH_DIM_R                                      ~11     !1, 'last_name'
          9        FETCH_DIM_W                                      $6      !2, ~5
         10        FETCH_DIM_W                                      $10     $6, ~9
         11        FETCH_DIM_W                                      $12     $10, ~11
         12        ASSIGN_DIM                                               $12
         13        OP_DATA                                                  !1
   14    14      > JMP                                                      ->2
         15    >   FE_FREE                                                  $4
   17    16        INIT_FCALL                                               'var_export'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
   21    19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.41 ms | 1395 KiB | 15 Q