3v4l.org

run code in 300+ PHP versions simultaneously
<?php $profits = array(5,7,2,4,7,3,6); for($i = 0, $length = count($profits); $i < $length; $i++) { $sixMonthAvg = array_slice($profits, ($i - 5 >= 0 ?$i - 5:0), 6); echo round(array_sum($sixMonthAvg) / count($sixMonthAvg), 2) . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 5
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 5
Branch analysis from position: 32
Branch analysis from position: 5
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 5
Branch analysis from position: 32
Branch analysis from position: 5
filename:       /in/YCev7
function name:  (null)
number of ops:  33
compiled vars:  !0 = $profits, !1 = $i, !2 = $length, !3 = $sixMonthAvg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, 0
          2        COUNT                                            ~6      !0
          3        ASSIGN                                                   !2, ~6
          4      > JMP                                                      ->30
    7     5    >   INIT_FCALL                                               'array_slice'
          6        SEND_VAR                                                 !0
          7        SUB                                              ~8      !1, 5
          8        IS_SMALLER_OR_EQUAL                                      0, ~8
          9      > JMPZ                                                     ~9, ->13
         10    >   SUB                                              ~10     !1, 5
         11        QM_ASSIGN                                        ~11     ~10
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~11     0
         14    >   SEND_VAL                                                 ~11
         15        SEND_VAL                                                 6
         16        DO_ICALL                                         $12     
         17        ASSIGN                                                   !3, $12
    8    18        INIT_FCALL                                               'round'
         19        INIT_FCALL                                               'array_sum'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $14     
         22        COUNT                                            ~15     !3
         23        DIV                                              ~16     $14, ~15
         24        SEND_VAL                                                 ~16
         25        SEND_VAL                                                 2
         26        DO_ICALL                                         $17     
         27        CONCAT                                           ~18     $17, '%0A'
         28        ECHO                                                     ~18
    6    29        PRE_INC                                                  !1
         30    >   IS_SMALLER                                               !1, !2
         31      > JMPNZ                                                    ~20, ->5
    9    32    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.09 ms | 1396 KiB | 19 Q