3v4l.org

run code in 300+ PHP versions simultaneously
<?php $intersecting_arrays = Array ( 0 => Array ( 'one' => 10, 'two' => 20, 'three' => 50, 'four' => 80, 'five' => 100 ), 1 => Array ( 'three' => 20, 'five' => 20, 'six' => 100, 'seven' => 10 ), 2 => Array ( 'one' => 30, 'three' => 30, 'five' => 10, 'eight' => 10 ) ); $temp = $intersecting_arrays[0]; for($i = 1; $i < count($intersecting_arrays); $i++) { $temp = array_intersect_key($temp, $intersecting_arrays[$i]); } $result = Array(); foreach(array_keys($temp) as $key => $val) { $value = 0; foreach($intersecting_arrays as $val1) { $value+= $val1[$val]; } $result[$key] = $value / count($intersecting_arrays); } print_r($temp); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 34
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 34
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 28
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 28
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
Branch analysis from position: 5
filename:       /in/j8o75
function name:  (null)
number of ops:  42
compiled vars:  !0 = $intersecting_arrays, !1 = $temp, !2 = $i, !3 = $result, !4 = $val, !5 = $key, !6 = $value, !7 = $val1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        FETCH_DIM_R                                      ~9      !0, 0
          2        ASSIGN                                                   !1, ~9
   10     3        ASSIGN                                                   !2, 1
          4      > JMP                                                      ->12
   11     5    >   INIT_FCALL                                               'array_intersect_key'
          6        SEND_VAR                                                 !1
          7        FETCH_DIM_R                                      ~12     !0, !2
          8        SEND_VAL                                                 ~12
          9        DO_ICALL                                         $13     
         10        ASSIGN                                                   !1, $13
   10    11        PRE_INC                                                  !2
         12    >   COUNT                                            ~16     !0
         13        IS_SMALLER                                               !2, ~16
         14      > JMPNZ                                                    ~17, ->5
   14    15    >   ASSIGN                                                   !3, <array>
   15    16        INIT_FCALL                                               'array_keys'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $19     
         19      > FE_RESET_R                                       $20     $19, ->34
         20    > > FE_FETCH_R                                       ~21     $20, !4, ->34
         21    >   ASSIGN                                                   !5, ~21
   16    22        ASSIGN                                                   !6, 0
   17    23      > FE_RESET_R                                       $24     !0, ->28
         24    > > FE_FETCH_R                                               $24, !7, ->28
   18    25    >   FETCH_DIM_R                                      ~25     !7, !4
         26        ASSIGN_OP                                     1          !6, ~25
   17    27      > JMP                                                      ->24
         28    >   FE_FREE                                                  $24
   20    29        COUNT                                            ~28     !0
         30        DIV                                              ~29     !6, ~28
         31        ASSIGN_DIM                                               !3, !5
         32        OP_DATA                                                  ~29
   15    33      > JMP                                                      ->20
         34    >   FE_FREE                                                  $20
   23    35        INIT_FCALL                                               'print_r'
         36        SEND_VAR                                                 !1
         37        DO_ICALL                                                 
   24    38        INIT_FCALL                                               'print_r'
         39        SEND_VAR                                                 !3
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.26 ms | 1400 KiB | 19 Q