3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo($seconds) { $t = round($seconds); //echo round($t/3600); if (round($t/3600) > 0) return sprintf('%02d:%02d:%02d', ($t/3600),($t/60%60), $t%60); return sprintf('%02d:%02d', ($t/60%60), $t%60); } echo foo('290.52262423327'). "\n"; echo foo('9290.52262423327'). "\n"; echo foo(86400+120+6). "\n";
based on mr4OQ
Output for 4.3.0 - 7.2.0
04:51 02:34:51 24:02:06