3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = array(-3,5,1,3,2,10); function array_avg($array) { $sum = 0; for ($i = 0; $i <= count($array); $i++) { $sum += $array[$i]; } echo $sum; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cnhcS
function name:  (null)
number of ops:  2
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1      > RETURN                                                   1

Function array_avg:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
Branch analysis from position: 4
filename:       /in/cnhcS
function name:  array_avg
number of ops:  12
compiled vars:  !0 = $array, !1 = $sum, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, 0
    6     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->7
    7     4    >   FETCH_DIM_R                                      ~5      !0, !2
          5        ASSIGN_OP                                     1          !1, ~5
    6     6        PRE_INC                                                  !2
          7    >   COUNT                                            ~8      !0
          8        IS_SMALLER_OR_EQUAL                                      !2, ~8
          9      > JMPNZ                                                    ~9, ->4
    9    10    >   ECHO                                                     !1
   10    11      > RETURN                                                   null

End of function array_avg

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.12 ms | 1398 KiB | 13 Q