3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myarray = [ [ 'messageId' => '5ACE9D8841', 'sender' => 'john@doe.com' ], [ 'messageId' => '7EE67D8170', 'sender' => 'dan@doe.com' ], [ 'messageId' => '8095FD8836', 'sender' => 'cat@doe.com' ], [ 'messageId' => '7EE67D8170', 'dest' => 'mitch@doe.com', 'status' => 'sent', 'date' => '2021-02-01 11:06:55' ] ]; var_export( array_reduce( $myarray, function($result, $row) { static $ref; if (!isset($ref[$row['messageId']])) { $ref[$row['messageId']] = $row; $result[] = &$ref[$row['messageId']]; } else { $ref[$row['messageId']] += $row; } return $result; } ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PTVMq
function name:  (null)
number of ops:  10
compiled vars:  !0 = $myarray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   24     1        INIT_FCALL                                               'var_export'
   25     2        INIT_FCALL                                               'array_reduce'
   26     3        SEND_VAR                                                 !0
   27     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPTVMq%3A27%240'
   36     5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                                 
   38     9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FPTVMq%3A27%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PTVMq
function name:  {closure}
number of ops:  21
compiled vars:  !0 = $result, !1 = $row, !2 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   28     2        BIND_STATIC                                              !2
   29     3        FETCH_DIM_R                                      ~3      !1, 'messageId'
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~4      !2, ~3
          5        BOOL_NOT                                         ~5      ~4
          6      > JMPZ                                                     ~5, ->16
   30     7    >   FETCH_DIM_R                                      ~6      !1, 'messageId'
          8        ASSIGN_DIM                                               !2, ~6
          9        OP_DATA                                                  !1
   31    10        FETCH_DIM_R                                      ~9      !1, 'messageId'
         11        FETCH_DIM_W                                      $10     !2, ~9
         12        MAKE_REF                                         $11     $10
         13        FETCH_DIM_W                                      $8      !0
         14        ASSIGN_REF                                               $8, $11
         15      > JMP                                                      ->19
   33    16    >   FETCH_DIM_R                                      ~13     !1, 'messageId'
         17        ASSIGN_DIM_OP                +=               1          !2, ~13
         18        OP_DATA                                                  !1
   35    19    > > RETURN                                                   !0
   36    20*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FPTVMq%3A27%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.98 ms | 1407 KiB | 17 Q