For a daily calendar application, I want to print out the hours of the day from nine in the morning to eight at night. I am using the following syntax which works up through 12. However, then I want to restart the numbering on 1 and have it continue to 8. I know this could be done in a more complicated way with multiple if then expressions and so forth but hoping there is a clean way to do it with one elegant expression. This is partly because there is a database query in the midst of this that I would like to write out only once. Here is basic code:
PHP
//following works up to 12
for($hourofday = 9; $hourofday <= 12; $hourofday++):
//I want to do something like following but the following does not work.
//for($hourofday = 9; $hourofday <= 12 || $hourofday >=1 && $hourofday <=8); $hourofday++):
$output.= $hourofday.':00';
//This is where dbase is queried for events and there is formatting so it looks like a calendar
endfor
Thanks for any suggestions!