3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array( 'imp' => 1000, 'clk' => 100, 'date' => 20150601 ), array( 'imp' => 1002, 'clk' => 102, 'date' => 20150602 ), array( 'imp' => 1003, 'clk' => 103, 'date' => 20150601 ) ); $result = array_reduce($arr, function($left, $right) { if(isset($right['imp'])) $left['imp'] += $right['imp']; if(isset($right['clk'])) $left['clk'] += $right['clk']; return $left; }, [ 'imp' => 0, 'clk' => 0 ]); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/58v94
function name:  (null)
number of ops:  12
compiled vars:  !0 = $arr, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   23     1        INIT_FCALL                                               'array_reduce'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F58v94%3A23%240'
   28     4        SEND_VAL                                                 ~3
   29     5        SEND_VAL                                                 <array>
          6        DO_ICALL                                         $4      
   23     7        ASSIGN                                                   !1, $4
   33     8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F58v94%3A23%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 7
filename:       /in/58v94
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $left, !1 = $right
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'imp'
          3      > JMPZ                                                     ~2, ->7
          4    >   FETCH_DIM_R                                      ~4      !1, 'imp'
          5        ASSIGN_DIM_OP                +=               1          !0, 'imp'
          6        OP_DATA                                                  ~4
   25     7    >   ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'clk'
          8      > JMPZ                                                     ~5, ->12
          9    >   FETCH_DIM_R                                      ~7      !1, 'clk'
         10        ASSIGN_DIM_OP                +=               1          !0, 'clk'
         11        OP_DATA                                                  ~7
   27    12    > > RETURN                                                   !0
   28    13*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F58v94%3A23%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.13 ms | 1396 KiB | 17 Q