3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ "a" => 0.333, "b" => 0.730, "c" => 0.393 ], [ "a" => 0.323, "b" => 0.454, "c" => 0.987 ], [ "a" => 0.753, "b" => 0.983, "c" => 0.123 ] ]; var_export( array_reduce( array_keys($array[0] ?? []), fn($result, $k) => $result + [$k => array_sum($c = array_column($array, $k)) / count($c)], [] ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RCQ62
function name:  (null)
number of ops:  19
compiled vars:  !0 = $array, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   21     1        INIT_FCALL                                               'var_export'
   22     2        INIT_FCALL                                               'array_reduce'
   23     3        INIT_FCALL                                               'array_keys'
          4        FETCH_DIM_IS                                     ~3      !0, 0
          5        COALESCE                                         ~4      ~3
          6        QM_ASSIGN                                        ~4      <array>
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                         $5      
          9        SEND_VAR                                                 $5
   24    10        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
         11        BIND_LEXICAL                                             ~6, !1
         12        BIND_LEXICAL                                             ~6, !0
         13        SEND_VAL                                                 ~6
   25    14        SEND_VAL                                                 <array>
   22    15        DO_ICALL                                         $7      
   25    16        SEND_VAR                                                 $7
   21    17        DO_ICALL                                                 
   27    18      > 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/RCQ62
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $result, !1 = $k, !2 = $c, !3 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
          4        INIT_FCALL                                               'array_sum'
          5        INIT_FCALL                                               'array_column'
          6        SEND_VAR                                                 !3
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $4      
          9        ASSIGN                                           ~5      !2, $4
         10        SEND_VAL                                                 ~5
         11        DO_ICALL                                         $6      
         12        COUNT                                            ~7      !2
         13        DIV                                              ~8      $6, ~7
         14        INIT_ARRAY                                       ~9      ~8, !1
         15        ADD                                              ~10     !0, ~9
         16      > RETURN                                                   ~10
         17*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.74 ms | 1007 KiB | 18 Q