ID: 10031 Updated by: stas Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Closed Bug Type: Variables related Assigned To: Comments: Your mistake is that you regard $start_day as number. In most cases it's OK, but ++ acts differently on strings. So use $itchy = $start_day+0 or any other mean to make $itchy explicitly numeric. Previous Comments: --------------------------------------------------------------------------- [2001-03-27 17:15:30] [EMAIL PROTECTED] Hi, I tried to do something which was not really weird, but the the output astounded me. I tried to get opinions of two of my friends on this, but they didn't really help. I feel really stupid, because this looks much more like one of my programming errors then a bug. I tried to execute this script: <? echo "<H1>Start Day = $start_day,View_Days=$view_days</H1>"; for ($itchy = $start_day; $itchy <= ($start_day+$view_days);$itchy++) { $this_mktime=mktime(0,0,0,date("m"),date("d")+$itchy,date("Y")); echo date("D j M",$this_mktime)."<BR>n"; } ?> I saved it in a file called test.php and called it from a website. like this: www.yoursite/test.php?start_day=4&view_days=10 The output was, as expected: Start Day = 4, View_Days= 10 Sun 1 Apr Mon 2 Apr Tue 3 Apr Wed 4 Apr Thu 5 Apr Fri 6 Apr Sat 7 Apr Sun 8 Apr Mon 9 Apr Tue 10 Apr Wed 11 Apr (Ok, it shows 11 days, but what the heck). Now, I tried to do this with some date in the past: www.yoursite/test.php?start_day=-2&view_days=10 The output is an endless loop with starts with this: Start Day = -2, View_Days= 10 Mon 26 Mar Sun 25 Mar Sat 24 Mar Fri 23 Mar Thu 22 Mar Wed 21 Mar Tue 20 Mar Mon 19 Mar Wed 28 Mar Tue 27 Mar Mon 26 Mar Sun 25 Mar Sat 24 Mar Fri 23 Mar Thu 22 Mar Wed 21 Mar Tue 20 Mar Mon 19 Mar Wed 28 Mar Tue 27 Mar Mon 26 Mar Sun 25 Mar Sat 24 Mar Fri 23 Mar Thu 22 Mar Wed 21 Mar Like I said, i feel really stupid now. What am I overlooking ? Much regards, keep up the good work, Ace Suares --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=10031&edit=2 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]