Re: [PHP] Re: A loop for the hours in a working day

2003-11-23 Thread Kelly Hallman
On Sun, 23 Nov 2003, David Otton wrote: > >How about something like this: > >$hstart = 7; $hend = 19; $interval = 15; > >for($h=$hstart; $h < $hend; $h++) { > > for($m=0; $m < 60; $m += $interval) { > >echo sprintf("%d:%02d",$h,$m); } } > > Couple of suggestions on top: > replace "echo sprintf

Re: [PHP] Re: A loop for the hours in a working day

2003-11-23 Thread David Otton
On Sun, 23 Nov 2003 10:49:58 -0800 (PST), you wrote: >That works, but it's a little unweildy.. especially if you want to change >the range later (changing the array may not be so bad, but then you've >got to figure out how many iterations your loops must do, etc). > >How about something like thi

Re: [PHP] Re: A loop for the hours in a working day

2003-11-23 Thread Kelly Hallman
On Sun, 23 Nov 2003, Shaun wrote: > Sorry, worked it out, here it is if anyone needs it :) > $minutes = array("00", "15", "30", "45"); > $hours = array("07", "08", "09", "10", "11", "12", "13", "14", "15", "16", > "17", "18", "19"); > for ($x = 0; $x < 13; $x++ ) { >for ($y = 0; $y < 4; $y++ )