3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $seconds = 2; $h = $seconds / 3600 % 24; $m = $seconds / 60 % 60; $s = $seconds % 60; $hours = 00; $minutes = 00; $seconds = 00; if ($h > 0){ if (strlen(strval($h)) == 1){ $hours = '0'.strval($h); } } if ($m > 0){ if (strlen(strval($m)) == 1){ $minutes = '0'.strval($m); } } if ($s > 0){ if (strlen(strval($s)) == 1){ $seconds = '0'.strval($s); } } $time = $hour.$minute.$second; echo $time;
Output for 5.0.4 - 5.0.5, 7.0.0 - 7.1.0
Notice: Undefined variable: hour in /in/pgd7d on line 26 Notice: Undefined variable: minute in /in/pgd7d on line 26 Notice: Undefined variable: second in /in/pgd7d on line 26
Output for 5.1.0 - 5.6.28
Notice: Undefined variable: minute in /in/pgd7d on line 26 Notice: Undefined variable: hour in /in/pgd7d on line 26 Notice: Undefined variable: second in /in/pgd7d on line 26
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: hour in /in/pgd7d on line 26 Notice: Undefined variable: minute in /in/pgd7d on line 26 Notice: Undefined variable: second in /in/pgd7d on line 26