|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-11-11 14:54 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 21:00:02 2025 UTC |
Description: ------------ This code is part of a larger while loop which stops when "$dayloop == false". This page is a report of employee clock-in and clock-out times. It shows the employee, followed by each day that the report includes, and their times. This code works in some circumstances, but most of the time, the 3rd line simply does not execute, or rather the value is never updated - thus resulting in an endless loop (because $dayloop stays true). It used to work perfectly (for over 6 months...) on several versions of PHP, so I do not believe this to be something version-related. Reproduce code: --------------- At this point, $thisday would be a date in the format "YYYY-mm-dd". $timestamp = strtotime($thisday); $timestamp = $timestamp + (60 * 60 * 24); <-- this line does not work if ($timestamp > strtotime($enddate)) { $dayloop = false; } $thisday = date("Y-m-d", $timestamp); <-- creates the above value Expected result: ---------------- $timestamp = $timestamp + (60 * 60 * 24) I expect the value of $timestamp to increase by 86400. Actual result: -------------- Sometimes the code works for a few cycles, but eventually it will stop incrementing the value of $timestamp and the script will time out.