3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getHours($time) { return $time / 3600; } function getMinutes($time) { return $time / 60 % 60; } function getSeconds($time) { return $time % 60; } function statAssoc($strg) { $return = 'Range: %02d|%02d|%02d Average: %02d|%02d|%02d Median: %02d|%02d|%02d'; $results = array_map(function($result) { return explode('|', trim($result)); }, explode(',', $strg)); $sums = []; for ($i = 0; $i < count($results); $i++) { $sums[] = ($results[$i][0] * 60 * 60) + ($results[$i][1] * 60) + ($results[$i][2]); } $range = max($sums) - min($sums); $average = array_sum($sums) / count($results); $median = (count($results) % 2 !== 0) ? $sums[floor(count($sums) / 2)] + $sums[ceil(count($sums) / 2)] : $sums[ceil(count($sums) / 2)]; var_dump(count($results) % 2); return sprintf( $return, getHours($range), getMinutes($range), getSeconds($range), getHours($average), getMinutes($average), getSeconds($average), getHours($median), getMinutes($median), getSeconds($median) ); } echo statAssoc("01|15|59, 1|47|16, 01|17|20, 1|32|34, 2|17|17, 1|1|1");
Output for git.master, git.master_jit, rfc.property-hooks
int(0) Deprecated: Implicit conversion from float 76.26666666666667 to int loses precision in /in/IXITh on line 7 Deprecated: Implicit conversion from float 91.90833333333333 to int loses precision in /in/IXITh on line 7 Deprecated: Implicit conversion from float 5514.5 to int loses precision in /in/IXITh on line 11 Deprecated: Implicit conversion from float 92.56666666666666 to int loses precision in /in/IXITh on line 7 Range: 01|16|16 Average: 01|31|54 Median: 01|32|34

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
53.25 ms | 402 KiB | 8 Q