3v4l.org

run code in 200+ 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 $time;
Output for 4.3.0 - 7.2.0
0:2