3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( 0 => array( 'event' => 'Conference', 'budget' => 3700, ), 1 => array( 'event' => 'Conference', 'budget' => 500, ), 2 => array( 'event' => 'Showroom', 'budget' => 1000, ), 3 => array( 'event' => 'Mission Chez client', 'budget' => 2000, ), 4 => array( 'event' => 'Séminaire', 'budget' => 700, ), 5 => array( 'event' => 'Livraison', 'budget' => 4000, ), 6 => array( 'event' => 'Conference', 'budget' => 334, ), ); var_export( array_reduce( $data, function ($carry, $row) { $carry[$row['event']] = ($carry[$row['event']] ?? 0) + $row['budget']; return $carry; } ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HS3UC
function name:  (null)
number of ops:  10
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   35     1        INIT_FCALL                                               'var_export'
   36     2        INIT_FCALL                                               'array_reduce'
   37     3        SEND_VAR                                                 !0
   38     4        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   41     5        SEND_VAL                                                 ~2
   36     6        DO_ICALL                                         $3      
   41     7        SEND_VAR                                                 $3
   35     8        DO_ICALL                                                 
   43     9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HS3UC
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $carry, !1 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   39     2        FETCH_DIM_R                                      ~2      !1, 'event'
          3        FETCH_DIM_R                                      ~4      !1, 'event'
          4        FETCH_DIM_IS                                     ~5      !0, ~4
          5        COALESCE                                         ~6      ~5
          6        QM_ASSIGN                                        ~6      0
          7        FETCH_DIM_R                                      ~7      !1, 'budget'
          8        ADD                                              ~8      ~6, ~7
          9        ASSIGN_DIM                                               !0, ~2
         10        OP_DATA                                                  ~8
   40    11      > RETURN                                                   !0
   41    12*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.56 ms | 999 KiB | 15 Q