a little bug in days_in_month() function ! - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: a little bug in days_in_month() function ! (/showthread.php?tid=51332) |
a little bug in days_in_month() function ! - El Forum - 04-30-2012 [eluser]josepichu[/eluser] Hi! I have found a little bug in days_in_month($month, $year) helper function. I Agugust and September months, i have to write the month without a zero. for example, if you write: Code: days_in_month(08,2012) // the function return '0' In the other months there is not problem with the zero. a greeting. a little bug in days_in_month() function ! - El Forum - 04-30-2012 [eluser]InsiteFX[/eluser] It's not a bug, php removes the leading 0's. To php they are just null values. a little bug in days_in_month() function ! - El Forum - 04-30-2012 [eluser]Stefan Hueg[/eluser] No he is correct, the behaviour is strange: Try this: Code: if(01 < 1 OR 01 > 12) But its PHP-related and has nothing to do with CodeIgniter. a little bug in days_in_month() function ! - El Forum - 04-30-2012 [eluser]josepichu[/eluser] Thanks . a little bug in days_in_month() function ! - El Forum - 04-30-2012 [eluser]Stefan Hueg[/eluser] [quote author="InsiteFX" date="1335786780"]It's not a bug, php removes the leading 0's. To php they are just null values. [/quote] False. I found the answer. 01, 02, 03, 04 etc. are octal notation. As there is no 08 or 09 in octal notation, the checks fail. |