|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-07-02 09:15 UTC] jani@php.net
[2008-07-02 10:10 UTC] glaesser at whsoft dot de
[2008-07-02 11:32 UTC] jani@php.net
[2008-07-02 11:33 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 00:00:02 2025 UTC |
Description: ------------ Following script works perfect on PHP 5.0.5-Debian-0.8~sarge1 but it produces infinite loops on PHP 5.1.2 or PHP 5.2.0-8+etch11. Reproduce code: --------------- $testArray = array(); $testArray[] = array('ueberdat' => '2008-04-01', 'rueckdat' => '2008-04-06'); $testArray[] = array('ueberdat' => '2008-04-12', 'rueckdat' => '2008-04-26'); $testArray[] = array('ueberdat' => '2008-04-26', 'rueckdat' => '2008-05-03'); $testArray[] = array('ueberdat' => '2008-05-10', 'rueckdat' => '2008-05-20'); $testArray[] = array('ueberdat' => '2008-05-24', 'rueckdat' => '2008-06-07'); $testArray[] = array('ueberdat' => '2008-06-14', 'rueckdat' => '2008-06-21'); $testArray[] = array('ueberdat' => '2008-06-21', 'rueckdat' => '2008-06-28'); $testArray[] = array('ueberdat' => '2008-06-28', 'rueckdat' => '2008-07-05'); $testArray[] = array('ueberdat' => '2008-07-05', 'rueckdat' => '2008-07-12'); $testArray[] = array('ueberdat' => '2008-07-19', 'rueckdat' => '2008-07-26'); $testArray[] = array('ueberdat' => '2008-07-26', 'rueckdat' => '2008-08-02'); $testArray[] = array('ueberdat' => '2008-08-02', 'rueckdat' => '2008-08-16'); $testArray[] = array('ueberdat' => '2008-08-23', 'rueckdat' => '2008-09-06'); $testArray[] = array('ueberdat' => '2008-09-13', 'rueckdat' => '2008-09-20'); $testArray[] = array('ueberdat' => '2008-09-27', 'rueckdat' => '2008-10-04'); $testArray[] = array('ueberdat' => '2008-10-11', 'rueckdat' => '2008-10-15'); $testArray[] = array('ueberdat' => '2008-10-25', 'rueckdat' => '2008-11-02'); $arrRet = array(); foreach ($testArray as $testValue) { $startDat = $testValue['ueberdat']; while ($startDat < $testValue['rueckdat']) { $arrRet[] = array('belDat' => $startDat); $startDat = date("Y-m-d", strtotime($startDat)+86400); } } print_r($arrRet); Expected result: ---------------- I want all days from the given dates like... Array ( [0] => Array ( [belDat] => 2008-04-01 ) [1] => Array ( [belDat] => 2008-04-02 ) [2] => Array ( [belDat] => 2008-04-03 ) [3] => Array ( [belDat] => 2008-04-04 ) [4] => Array ( [belDat] => 2008-04-05 ) [5] => Array ( [belDat] => 2008-04-12 ) [6] => Array ( [belDat] => 2008-04-13 ) [7] => Array ( [belDat] => 2008-04-14 ) [8] => Array ( [belDat] => 2008-04-15 ) ... and so on Actual result: -------------- Script timeout on new PHP-Version.