3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ ['user_id' => 82, 'ac_type' => 1, 'irrelevant' => 'a'], ['user_id' => 80, 'ac_type' => 5, 'irrelevant' => 'b'], ['user_id' => 76, 'ac_type' => 1, 'irrelevant' => 'c'], ['user_id' => 82, 'ac_type' => 1, 'irrelevant' => 'd'], ['user_id' => 80, 'ac_type' => 5, 'irrelevant' => 'e'] ]; foreach ($array as $row) { $compositeKey = $row['user_id'] . '_' . $row['ac_type']; $result[$compositeKey] ??= $row; // only store if first occurrence of compositeKey } var_export(array_values($result)); // re-index and print
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/Sfrg7a
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array, !1 = $row, !2 = $compositeKey, !3 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   10     1      > FE_RESET_R                                           $5      !0, ->15
          2    > > FE_FETCH_R                                                   $5, !1, ->15
   11     3    >   FETCH_DIM_R                                          ~6      !1, 'user_id'
          4        CONCAT                                               ~7      ~6, '_'
          5        FETCH_DIM_R                                          ~8      !1, 'ac_type'
          6        CONCAT                                               ~9      ~7, ~8
          7        ASSIGN                                                       !2, ~9
   12     8        FETCH_DIM_IS                                         ~11     !3, !2
          9        COALESCE                                             ~12     ~11
         10        ASSIGN_DIM                                           ~13     !3, !2
         11        OP_DATA                                                      !1
         12        QM_ASSIGN                                            ~12     ~13
         13        FREE                                                         ~12
   10    14      > JMP                                                          ->2
         15    >   FE_FREE                                                      $5
   14    16        INIT_FCALL                                                   'var_export'
         17        INIT_FCALL                                                   'array_values'
         18        SEND_VAR                                                     !3
         19        DO_ICALL                                             $14     
         20        SEND_VAR                                                     $14
         21        DO_ICALL                                                     
         22      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
200.74 ms | 1751 KiB | 15 Q