On Monday, November 24, 2003, at 02:34 AM, Shaun wrote:

Hi,

I need a loop that will print the hours in a day separated by every fifteen
minutes between 0700 and 1900 e.g.


07:00
07:15
07:30
07:45
08:00
08:15
...
19:00

How could I do this?

<? $start = 7; $end = 19; $h = $start; while($h <= $end) { if($h != $end) { echo "{$h}:00\n"; echo "{$h}:15\n"; echo "{$h}:30\n"; echo "{$h}:45\n"; } else { echo "{$h}:00\n"; } $h++; } ?>

There's plenty of ways, this is just one to get your head on the right track :)


Justin


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to