That should do it. Change the start number $ i to the number of minutes that the drop-down list should contain. Now it is set for 750 minutes.
echo '<select>';
for ($i = 750; $i >= 15; $i -= 15) {
$hours = $i / 60;
$min = $i % 60;
echo '<option>';
if ($hours >= 1)
echo floor($hours)." Hours ";
if ($min > 1)
echo $min." Minutes";
echo '</option>';
}
echo '</select>';
NOTE. This code is not perfect, the start number must be divided by 15 in order to obtain the desired result (however, it works).
user1043994
source
share