Determining a Part of an Hour in PHP
Let us have a variable $min,
which stores the number of minutes from 0
to 59:
<?php
$min = 10;
?>
Let's determine which quarter of the hour the specified number of minutes falls into:
<?php
$min = 10;
if ($min >= 0 and $min <= 14) {
echo '1 quarter';
}
if ($min >= 15 and $min <= 29) {
echo '2 quarter';
}
if ($min >= 30 and $min <= 44) {
echo '3 quarter';
}
if ($min >= 45 and $min <= 59) {
echo '4 quarter';
}
?>
Solve a similar problem, but determine which third of the hour the specified number of minutes falls into.