3v4l.org

run code in 300+ PHP versions simultaneously
<?php $times = array( 1375110404, 1374660925, 1374482694, 1374242337, 1373793867, 1373632889, 1373187141, 1373021668, 1372754021, 1372599890, ); var_dump(array_average_diff($times)); function array_average_diff(array $array) { $diff = 0; for($i = 1; $i < count($array); $i++){ $diff += abs($array[$i] - $array[$i - 1]); } return $diff/count($array); } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O1efb
function name:  (null)
number of ops:  8
compiled vars:  !0 = $times
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL_BY_NAME                                       'array_average_diff'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
   26     7      > RETURN                                                   1

Function array_average_diff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
Branch analysis from position: 4
filename:       /in/O1efb
function name:  array_average_diff
number of ops:  20
compiled vars:  !0 = $array, !1 = $diff, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   20     1        ASSIGN                                                   !1, 0
   21     2        ASSIGN                                                   !2, 1
          3      > JMP                                                      ->13
   22     4    >   INIT_FCALL                                               'abs'
          5        FETCH_DIM_R                                      ~5      !0, !2
          6        SUB                                              ~6      !2, 1
          7        FETCH_DIM_R                                      ~7      !0, ~6
          8        SUB                                              ~8      ~5, ~7
          9        SEND_VAL                                                 ~8
         10        DO_ICALL                                         $9      
         11        ASSIGN_OP                                     1          !1, $9
   21    12        PRE_INC                                                  !2
         13    >   COUNT                                            ~12     !0
         14        IS_SMALLER                                               !2, ~12
         15      > JMPNZ                                                    ~13, ->4
   24    16    >   COUNT                                            ~14     !0
         17        DIV                                              ~15     !1, ~14
         18      > RETURN                                                   ~15
   25    19*     > RETURN                                                   null

End of function array_average_diff

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.66 ms | 1400 KiB | 18 Q