3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $times = array( 3375110404, 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); }
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
float(200251051.4)
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/QteR7 on line 18
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_ARRAY, expecting ')' in /in/QteR7 on line 18
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_ARRAY, expecting ')' in /in/QteR7 on line 18
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/QteR7 on line 18
Process exited with code 255.