3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function _AVG($args){ /*$count = func_num_args(); $args = func_get_args();*/ $count = count($args); $sum = array_sum($args); return bcdiv($sum,$count,2); } function _AVG1($args){ /*$count = func_num_args(); $args = func_get_args();*/ $count = count($args); //$sum = array_sum($args); return array_sum($args) / $count; } echo bcdiv(bcmul(bcadd(_AVG(array(3.17,2.22,2.54)),3.17,2),0.95,2),2,2); echo '<br />'; echo _AVG1(array(3.17,2.22,2.54));
Output for 4.3.0 - 5.5.33, 5.5.35 - 5.6.19, 5.6.21 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.0.4, 7.0.6 - 7.1.0
2.75<br />2.6433333333333
Output for 7.0.5
Fatal error: Uncaught Error: Call to undefined function bcdiv() in /in/YMfcM:17 Stack trace: #0 {main} thrown in /in/YMfcM on line 17
Process exited with code 255.
Output for 5.5.34, 5.6.20
Fatal error: Call to undefined function bcdiv() in /in/YMfcM on line 17
Process exited with code 255.