3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['name' => 'John Doe', 'age' => '36', 'code' => '437', 'group' => '1000'], ['name' => 'John Doe', 'age' => '36', 'code' => '437', 'group' => '7777'], ['name' => 'John Doe', 'age' => '36', 'code' => '437', 'group' => '7777'], ['name' => 'John Doe', 'age' => '36', 'code' => '437', 'group' => '4000'], ['name' => 'John Doe', 'age' => '36', 'code' => '437', 'group' => '4000'], ['name' => 'John Doe', 'age' => '36', 'code' => '437', 'group' => '5000'], ['name' => 'John Doe', 'age' => '36', 'code' => '437', 'group' => '6000'], ['name' => 'John Doe', 'age' => '36', 'code' => '437', 'group' => '6000'] ]; foreach ($array as $row) { if (!isset($result[$row['code']])) { $result[$row['code']] = ['name' => $row['name'], 'age' => $row['age']]; } $result[$row['code']][in_array($row['group'], ['7777','6000']) ? $row['group'] : 'others'][] = [$row['code'], $row['group']]; } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 34
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 34
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 14
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/O8DqO
function name:  (null)
number of ops:  42
compiled vars:  !0 = $array, !1 = $row, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   13     1      > FE_RESET_R                                       $4      !0, ->34
          2    > > FE_FETCH_R                                               $4, !1, ->34
   14     3    >   FETCH_DIM_R                                      ~5      !1, 'code'
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !2, ~5
          5        BOOL_NOT                                         ~7      ~6
          6      > JMPZ                                                     ~7, ->14
   15     7    >   FETCH_DIM_R                                      ~8      !1, 'code'
          8        FETCH_DIM_R                                      ~10     !1, 'name'
          9        INIT_ARRAY                                       ~11     ~10, 'name'
         10        FETCH_DIM_R                                      ~12     !1, 'age'
         11        ADD_ARRAY_ELEMENT                                ~11     ~12, 'age'
         12        ASSIGN_DIM                                               !2, ~8
         13        OP_DATA                                                  ~11
   17    14    >   FETCH_DIM_R                                      ~13     !1, 'code'
         15        INIT_FCALL                                               'in_array'
         16        FETCH_DIM_R                                      ~15     !1, 'group'
         17        SEND_VAL                                                 ~15
         18        SEND_VAL                                                 <array>
         19        DO_ICALL                                         $16     
         20      > JMPZ                                                     $16, ->24
         21    >   FETCH_DIM_R                                      ~17     !1, 'group'
         22        QM_ASSIGN                                        ~18     ~17
         23      > JMP                                                      ->25
         24    >   QM_ASSIGN                                        ~18     'others'
         25    >   FETCH_DIM_R                                      ~21     !1, 'code'
         26        INIT_ARRAY                                       ~22     ~21
         27        FETCH_DIM_R                                      ~23     !1, 'group'
         28        ADD_ARRAY_ELEMENT                                ~22     ~23
         29        FETCH_DIM_W                                      $14     !2, ~13
         30        FETCH_DIM_W                                      $19     $14, ~18
         31        ASSIGN_DIM                                               $19
         32        OP_DATA                                                  ~22
   13    33      > JMP                                                      ->2
         34    >   FE_FREE                                                  $4
   19    35        INIT_FCALL                                               'var_export'
         36        INIT_FCALL                                               'array_values'
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                         $24     
         39        SEND_VAR                                                 $24
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.89 ms | 1017 KiB | 16 Q