Re: A loop for the hours in a working day

From: Date: Mon, 24 Nov 2003 01:45:58 +0000
Subject: Re: A loop for the hours in a working day
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-170751@lists.php.net to get a copy of this message
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

« previous php.general (#170751) next »