Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September, so I have been playing around it and found the problem. I recently wrote a demo script for you all to play around with. Let me know which PHP version does this bug not affected you.... I'm going to file a PHP bug at http://bug.php.net...... I'll let you know where PHP bug # is it. To tell you the truth, I don't know how to search for existing bug on this one if there is any because I don't know if it is an if-statement issue or if it is something else.... Feel free to submit a patch if you know how.
Let me know what you found and post it here... --clip-- <? //Sample Code..... ================================================== $VARIABLE[0] = "2002-01"; $VARIABLE[1] = "2002-02"; $VARIABLE[2] = "2002-03"; $VARIABLE[3] = "2002-04"; $VARIABLE[4] = "2002-05"; $VARIABLE[5] = "2002-06"; $VARIABLE[6] = "2002-07"; $VARIABLE[7] = "2002-08"; $VARIABLE[8] = "2002-09"; $VARIABLE[9] = "2002-10"; $VARIABLE[10] = "2002-11"; $VARIABLE[11] = "2002-12"; //Loop Code to check the variable.... =============================== for ($x=0;$x<12;$x++) { $month = substr($VARIABLE[$x],5,2); echo "The # of month is ".$x."<br>"; if ($month == 01) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 02) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 03) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 04) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 05) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 06) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 07) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 08) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 09) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 10) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 11) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } if ($month == 12) { echo "It's a Match!!<br>"; } else { echo "It's not a Match!!<br>"; } echo "<br>"; } //Strange Workaround to 08 and 09 =================================== echo "Strange Workaround to the Problem!!<br><br>"; $month = substr($VARIABLE[7],5,2); echo "The # of month is 08<br>"; if (trim($month) == 8) { echo "It's working!!!<br>"; } $month = substr($VARIABLE[8],5,2); echo "The # of month is 09<br>"; if (trim($month) == 9) { echo "It's working!!!<br>"; } //Testing (Should this be working or not??) ========================= echo "<br><br>"; $month = substr($VARIABLE[0],5,2); echo "The # of month is 1<br>"; if (trim($month) == 1) { //With "1" as an integer... echo "It's working!!!<br>"; } echo "<br>"; $month = substr($VARIABLE[0],5,2); echo "The # of month is 01<br>"; if (trim($month) == 01) { //With "01" as an integer echo "It's working!!!<br>"; } echo "<br>"; $month = substr($VARIABLE[0],5,2); echo "The # of month is 1<br>"; if (trim($month) == "1") { //With "1" as an integer... echo "It's working!!!<br>"; } echo "<br>"; $month = substr($VARIABLE[0],5,2); echo "The # of month is 01<br>"; if (trim($month) == "01") { //With "01" as an integer echo "It's working!!!<br>"; } ?> --clip-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php