3v4l.org

run code in 300+ PHP versions simultaneously
<?php $collection = [ [1 => 10.0, 2 => 20.0, 3 => 50.0, 4 => 80.0, 5 => 100.0], [3 => 20.0, 5 => 20.0, 6 => 100.0, 7 => 10.0], [1 => 30.0, 3 => 30.0, 5 => 10.0, 8 => 10.0] ]; var_export( array_reduce( array_keys( array_intersect_ukey( ...array_merge( $collection, [fn($a, $b) => $a <=> $b] ) ) ), fn($result, $k) => $result + [$k => array_sum(array_column($collection, $k)) / count($collection)], [] ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kRVDc
function name:  (null)
number of ops:  25
compiled vars:  !0 = $collection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'var_export'
   11     2        INIT_FCALL                                               'array_reduce'
   12     3        INIT_FCALL                                               'array_keys'
   13     4        INIT_FCALL                                               'array_intersect_ukey'
   14     5        INIT_FCALL                                               'array_merge'
   15     6        SEND_VAR                                                 !0
   16     7        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          8        INIT_ARRAY                                       ~3      ~2
          9        SEND_VAL                                                 ~3
   14    10        DO_ICALL                                         $4      
   16    11        SEND_UNPACK                                              $4
         12        CHECK_UNDEF_ARGS                                         
   13    13        DO_ICALL                                         $5      
   16    14        SEND_VAR                                                 $5
   12    15        DO_ICALL                                         $6      
   16    16        SEND_VAR                                                 $6
   20    17        DECLARE_LAMBDA_FUNCTION                          ~7      [1]
         18        BIND_LEXICAL                                             ~7, !0
   21    19        SEND_VAL                                                 ~7
   22    20        SEND_VAL                                                 <array>
   11    21        DO_ICALL                                         $8      
   22    22        SEND_VAR                                                 $8
   10    23        DO_ICALL                                                 
   24    24      > 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/kRVDc
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        SPACESHIP                                        ~2      !0, !1
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kRVDc
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $result, !1 = $k, !2 = $collection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   21     3        INIT_FCALL                                               'array_sum'
          4        INIT_FCALL                                               'array_column'
          5        SEND_VAR                                                 !2
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                         $4      
         10        COUNT                                            ~5      !2
         11        DIV                                              ~6      $4, ~5
         12        INIT_ARRAY                                       ~7      ~6, !1
         13        ADD                                              ~8      !0, ~7
         14      > RETURN                                                   ~8
         15*     > RETURN                                                   null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
191.89 ms | 1013 KiB | 20 Q