3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Function to print moving average function movingAverage($win_numbers, $average_for) { foreach($win_numbers as $key=>$value){ $win_number_consecutive_5 = array_slice($win_numbers, $key, $average_for); $win_averages[] = array_sum($win_number_consecutive_5) / $average_for; } return $win_averages; } echo "Moving Averages:<br>"; $win_numbers = explode('-','3-4-5-6-7-8-4-5-6-33-23-12-5-1'); $average_for = 5; echo implode('-',movingAverage($win_numbers, $average_for)); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GO0Ai
function name:  (null)
number of ops:  14
compiled vars:  !0 = $win_numbers, !1 = $average_for
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                         'Moving+Averages%3A%3Cbr%3E'
   13     1        INIT_FCALL                                                   'explode'
          2        SEND_VAL                                                     '-'
          3        SEND_VAL                                                     '3-4-5-6-7-8-4-5-6-33-23-12-5-1'
          4        DO_ICALL                                             $2      
          5        ASSIGN                                                       !0, $2
   14     6        ASSIGN                                                       !1, 5
   15     7        INIT_FCALL                                                   'movingaverage'
          8        SEND_VAR                                                     !0
          9        SEND_VAR                                                     !1
         10        DO_FCALL                                          0  $5      
         11        FRAMELESS_ICALL_2                implode             ~6      '-', $5
         12        ECHO                                                         ~6
   16    13      > RETURN                                                       1

Function movingaverage:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/GO0Ai
function name:  movingAverage
number of ops:  21
compiled vars:  !0 = $win_numbers, !1 = $average_for, !2 = $value, !3 = $key, !4 = $win_number_consecutive_5, !5 = $win_averages
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    5     2      > FE_RESET_R                                           $6      !0, ->18
          3    > > FE_FETCH_R                                           ~7      $6, !2, ->18
          4    >   ASSIGN                                                       !3, ~7
    6     5        INIT_FCALL                                                   'array_slice'
          6        SEND_VAR                                                     !0
          7        SEND_VAR                                                     !3
          8        SEND_VAR                                                     !1
          9        DO_ICALL                                             $9      
         10        ASSIGN                                                       !4, $9
    7    11        INIT_FCALL                                                   'array_sum'
         12        SEND_VAR                                                     !4
         13        DO_ICALL                                             $12     
         14        DIV                                                  ~13     $12, !1
         15        ASSIGN_DIM                                                   !5
         16        OP_DATA                                                      ~13
    5    17      > JMP                                                          ->3
         18    >   FE_FREE                                                      $6
    9    19      > RETURN                                                       !5
   10    20*     > RETURN                                                       null

End of function movingaverage

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
172.19 ms | 2354 KiB | 17 Q