3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 1649 => ["firstName" => "jack", "lastName" => "straw"], 1650 => ["firstName" => "jack", "lastName" => "straw"], 1651 => ["firstName" => "jack", "lastName" => "straw"], 1652 => ["firstName" => "jack", "lastName" => "straw"], 1653 => ["firstName" => "jack1", "lastName" => "straw"], 1654 => ["firstName" => "jack1", "lastName" => "straw"] ]; foreach ($array as $key => &$row) { $compositeKey = $row['firstName'] . '-' . $row['firstName']; if (!isset($ref[$compositeKey])) { $ref[$compositeKey] = &$row; } else { $ref[$compositeKey]['mergedWith'][] = $key; unset($array[$key]); } } var_export($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 21
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/OYnbC
function name:  (null)
number of ops:  26
compiled vars:  !0 = $array, !1 = $row, !2 = $key, !3 = $compositeKey, !4 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1      > FE_RESET_RW                                      $6      !0, ->21
          2    > > FE_FETCH_RW                                      ~7      $6, !1, ->21
          3    >   ASSIGN                                                   !2, ~7
   13     4        FETCH_DIM_R                                      ~9      !1, 'firstName'
          5        CONCAT                                           ~10     ~9, '-'
          6        FETCH_DIM_R                                      ~11     !1, 'firstName'
          7        CONCAT                                           ~12     ~10, ~11
          8        ASSIGN                                                   !3, ~12
   14     9        ISSET_ISEMPTY_DIM_OBJ                         0  ~14     !4, !3
         10        BOOL_NOT                                         ~15     ~14
         11      > JMPZ                                                     ~15, ->15
   15    12    >   FETCH_DIM_W                                      $16     !4, !3
         13        ASSIGN_REF                                               $16, !1
   14    14      > JMP                                                      ->20
   17    15    >   FETCH_DIM_W                                      $18     !4, !3
         16        FETCH_DIM_W                                      $19     $18, 'mergedWith'
         17        ASSIGN_DIM                                               $19
         18        OP_DATA                                                  !2
   18    19        UNSET_DIM                                                !0, !2
   12    20    > > JMP                                                      ->2
         21    >   FE_FREE                                                  $6
   21    22        INIT_FCALL                                               'var_export'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.13 ms | 1003 KiB | 14 Q