need help breaking out of loop.
| From: | anders thoresson | Date: | Thu, 26 Jun 2003 11:00:45 +0000 |
| Subject: | need help breaking out of loop. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-152950@lists.php.net to get a copy of this message | ||
Hi,
I'm working of a PHP-MySQL-planning system for a newspaper. I want to add dates and number for each issue. I have to following code, where $current_date is a unix timestamp.
If $current_date is a Saturday or Sunday, I want to quit the current execution of the loop and contiune with the next date. But when the if- clause that checks if $issue_day_of_week is Sunday or Saturday is included in my while-loop, everything stalls. Without it, everything goes smooth.
What am I missing?
while ($i <= $number_of_days)
{
$issue_date = strftime("%Y-%m-%d", $current_date);
$issue_month = date("m", $current_date);
$issue_day = date("d", $current_date);
$issue_day_of_week = date("l", $current_date);
// Check that $issue_date isn't Saturday or Sunday
if ($issue_day_of_week == "Sunday" | $issue_day_of_week == "Saturday")
{
continue;
}
if ($issue_month == 1 & $issue_day == 1)
{
$issue_number = 1;
$current_date = $current_date + 86400;
$i++;
$issue_number++;
continue;
}
$current_date = $current_date + 86400;
$i++;
$issue_number++;
}
--
anders thoresson