3v4l.org

run code in 200+ 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 7.2.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: count(): Parameter must be an array or an object that implements Countable in /in/jrdv9 on line 3 Warning: Division by zero in /in/jrdv9 on line 3
Output for 5.3.0 - 7.1.10
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 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