3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $aValues = array(9,4,-3,-10); $mean = array_sum($A) / count($A); 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); } ?>
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: A in /in/jrdv9 on line 3 Warning: array_sum() expects parameter 1 to be array, null given in /in/jrdv9 on line 3 Notice: Undefined variable: A in /in/jrdv9 on line 3 Warning: Division by zero in /in/jrdv9 on line 3
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: A in /in/jrdv9 on line 3 Warning: Invalid operand type was used: array_sum expects an array or collection as argument 1 in /in/jrdv9 on line 3 Notice: Undefined variable: A in /in/jrdv9 on line 3 Warning: Division by zero in /in/jrdv9 on line 3
Output for 5.0.4 - 5.2.17
Notice: Undefined variable: A in /in/jrdv9 on line 3 Warning: array_sum(): The argument should be an array in /in/jrdv9 on line 3 Notice: Undefined variable: A in /in/jrdv9 on line 3 Warning: Division by zero in /in/jrdv9 on line 3
Output for 4.3.2 - 5.0.3
Notice: Undefined variable: A in /in/jrdv9 on line 3 Warning: array_sum(): The argument should be an array in /in/jrdv9 on line 3 Notice: Undefined variable: A in /in/jrdv9 on line 3 Warning: Division by zero in /in/jrdv9 on line 3
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: A in /in/jrdv9 on line 3 Warning: array_sum() [http://www.php.net/function.array-sum]: The argument should be an array in /in/jrdv9 on line 3 Notice: Undefined variable: A in /in/jrdv9 on line 3 Warning: Division by zero in /in/jrdv9 on line 3