3v4l.org

run code in 300+ PHP versions simultaneously
<?php $aValues = array(9,4,-3,-10); function standard_deviation($aValues, $bSample = false) { $fMean = array_sum($aValues) / count($aValues); $fVariance = 0.0; foreach ($aValues as $i) { $fVariance += pow($i - $fMean, 2); } $fVariance /= ( $bSample ? count($aValues) - 1 : count($aValues) ); return (float) sqrt($fVariance); } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sWvoS
function name:  (null)
number of ops:  2
compiled vars:  !0 = $aValues
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   15     1      > RETURN                                                   1

Function standard_deviation:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/sWvoS
function name:  standard_deviation
number of ops:  33
compiled vars:  !0 = $aValues, !1 = $bSample, !2 = $fMean, !3 = $fVariance, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
    6     2        INIT_FCALL                                               'array_sum'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        COUNT                                            ~6      !0
          6        DIV                                              ~7      $5, ~6
          7        ASSIGN                                                   !2, ~7
    7     8        ASSIGN                                                   !3, 0
    8     9      > FE_RESET_R                                       $10     !0, ->18
         10    > > FE_FETCH_R                                               $10, !4, ->18
   10    11    >   INIT_FCALL                                               'pow'
         12        SUB                                              ~11     !4, !2
         13        SEND_VAL                                                 ~11
         14        SEND_VAL                                                 2
         15        DO_ICALL                                         $12     
         16        ASSIGN_OP                                     1          !3, $12
    8    17      > JMP                                                      ->10
         18    >   FE_FREE                                                  $10
   12    19      > JMPZ                                                     !1, ->24
         20    >   COUNT                                            ~14     !0
         21        SUB                                              ~15     ~14, 1
         22        QM_ASSIGN                                        ~16     ~15
         23      > JMP                                                      ->26
         24    >   COUNT                                            ~17     !0
         25        QM_ASSIGN                                        ~16     ~17
         26    >   ASSIGN_OP                                     4          !3, ~16
   13    27        INIT_FCALL                                               'sqrt'
         28        SEND_VAR                                                 !3
         29        DO_ICALL                                         $19     
         30        CAST                                          5  ~20     $19
         31      > RETURN                                                   ~20
   14    32*     > RETURN                                                   null

End of function standard_deviation

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.66 ms | 1400 KiB | 19 Q