3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['quantity' => 5, 'dd' => '01-Nov-2012'], ['quantity' => 10, 'dd' => '01-Nov-2012'], ['quantity' => 3, 'dd' => '02-Nov-2012'], ['quantity' => 4, 'dd' => '03-Nov-2012'], ['quantity' => 15, 'dd' => '03-Nov-2012'], ]; var_export( array_values( array_reduce( $array, function($result, $row) { if (!isset($result[$row['dd']])) { $result[$row['dd']] = $row; } else { $result[$row['dd']]['quantity'] += $row['quantity']; } return $result; } ) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSi1E
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'var_export'
   12     2        INIT_FCALL                                               'array_values'
   13     3        INIT_FCALL                                               'array_reduce'
   14     4        SEND_VAR                                                 !0
   15     5        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   22     6        SEND_VAL                                                 ~2
   13     7        DO_ICALL                                         $3      
   22     8        SEND_VAR                                                 $3
   12     9        DO_ICALL                                         $4      
   22    10        SEND_VAR                                                 $4
   11    11        DO_ICALL                                                 
   25    12      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSi1E
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $result, !1 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        FETCH_DIM_R                                      ~2      !1, 'dd'
          3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      !0, ~2
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->10
   17     6    >   FETCH_DIM_R                                      ~5      !1, 'dd'
          7        ASSIGN_DIM                                               !0, ~5
          8        OP_DATA                                                  !1
   16     9      > JMP                                                      ->15
   19    10    >   FETCH_DIM_R                                      ~7      !1, 'dd'
         11        FETCH_DIM_R                                      ~10     !1, 'quantity'
         12        FETCH_DIM_RW                                     $8      !0, ~7
         13        ASSIGN_DIM_OP                +=               1          $8, 'quantity'
         14        OP_DATA                                                  ~10
   21    15    > > RETURN                                                   !0
   22    16*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.27 ms | 1001 KiB | 16 Q