3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function formatDuration($sec){ $h = floor($sec/(60*60)); $m = floor(($sec%60)/60); $s = floor(($sec%60)%60); return sprintf("%02d:%02d:%02d", $h, $m, $s); } for ($i=0; $i < 60*60*1.5; $i+=150){ echo formatDuration($i), PHP_EOL; }
based on pcM5f
Output for 5.6.0 - 7.3.0rc4
00:00:00 00:00:30 00:00:00 00:00:30 00:00:00 00:00:30 00:00:00 00:00:30 00:00:00 00:00:30 00:00:00 00:00:30 00:00:00 00:00:30 00:00:00 00:00:30 00:00:00 00:00:30 00:00:00 00:00:30 00:00:00 00:00:30 00:00:00 00:00:30 01:00:00 01:00:30 01:00:00 01:00:30 01:00:00 01:00:30 01:00:00 01:00:30 01:00:00 01:00:30 01:00:00 01:00:30