3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = Array ( 'one' => 10, 'two' => 20, 'three' => 50, 'four' => 80, 'five' => 100 ); $arr2 = Array ( 'three' => 20, 'five' => 20, 'six' => 100, 'seven' => 10 ); $arr3 = Array ( 'one' => 30, 'three' => 30, 'five' => 10, 'eight' => 10 ); $array = array_merge_recursive($arr1,$arr2,$arr3); $key= "two"; If(is_array($array[$key])){ $avg = array_sum($array[$key])/count($array[$key]); }Else{ $avg = $array[$key]; } Echo $avg;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pa3PH
function name:  (null)
number of ops:  26
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $arr3, !3 = $array, !4 = $key, !5 = $avg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    6     3        INIT_FCALL                                               'array_merge_recursive'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !3, $9
    8     9        ASSIGN                                                   !4, 'two'
    9    10        FETCH_DIM_R                                      ~12     !3, !4
         11        TYPE_CHECK                                  128          ~12
         12      > JMPZ                                                     ~13, ->22
   10    13    >   INIT_FCALL                                               'array_sum'
         14        FETCH_DIM_R                                      ~14     !3, !4
         15        SEND_VAL                                                 ~14
         16        DO_ICALL                                         $15     
         17        FETCH_DIM_R                                      ~16     !3, !4
         18        COUNT                                            ~17     ~16
         19        DIV                                              ~18     $15, ~17
         20        ASSIGN                                                   !5, ~18
    9    21      > JMP                                                      ->24
   12    22    >   FETCH_DIM_R                                      ~20     !3, !4
         23        ASSIGN                                                   !5, ~20
   15    24    >   ECHO                                                     !5
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.77 ms | 1003 KiB | 15 Q