3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $seconds = 2; $m = $seconds / 60 % 60; $s = $seconds % 60; if ($m >= 1){ $rem = strval($s); if (strlen($rem) == 1){ $rem = sprintf("%02s", $rem); } $time = strval($m); $time = $time.":".$rem; } else if($m == 0){ $time = "0:".$s; } else{ $time = "0:00"; //Error } echo "<span style='margin-left:8px;'>Duration: ", $time, "</span><br>";
Output for 4.3.0 - 5.6.25, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<span style='margin-left:8px;'>Duration: 0:2</span><br>