3v4l.org

run code in 300+ PHP versions simultaneously
<?php $your_array = array(array("December 2012" => 58), array("December 2012" => 58) ); $res = array(); foreach($your_array as $val){ $res[key($val)][] = $val[key($val)]; } foreach($res as $k=>&$v){ $v = array_sum($v)/count($v); } echo "<pre>"; print_r($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
2 jumps found. (Code = 125) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
2 jumps found. (Code = 126) Position 1 = 18, Position 2 = 26
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 15
filename:       /in/DqVrr
function name:  (null)
number of ops:  32
compiled vars:  !0 = $your_array, !1 = $res, !2 = $val, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    6     2      > FE_RESET_R                                       $7      !0, ->15
          3    > > FE_FETCH_R                                               $7, !2, ->15
    7     4    >   INIT_FCALL                                               'key'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $8      
          7        INIT_FCALL                                               'key'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $11     
         10        FETCH_DIM_R                                      ~12     !2, $11
         11        FETCH_DIM_W                                      $9      !1, $8
         12        ASSIGN_DIM                                               $9
         13        OP_DATA                                                  ~12
    6    14      > JMP                                                      ->3
         15    >   FE_FREE                                                  $7
   10    16      > FE_RESET_RW                                      $13     !1, ->26
         17    > > FE_FETCH_RW                                      ~14     $13, !3, ->26
         18    >   ASSIGN                                                   !4, ~14
   11    19        INIT_FCALL                                               'array_sum'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $16     
         22        COUNT                                            ~17     !3
         23        DIV                                              ~18     $16, ~17
         24        ASSIGN                                                   !3, ~18
   10    25      > JMP                                                      ->17
         26    >   FE_FREE                                                  $13
   14    27        ECHO                                                     '%3Cpre%3E'
   15    28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.77 ms | 1396 KiB | 19 Q