|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-02-29 03:25 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 21:00:01 2025 UTC |
Description: ------------ Try the script below using a form input page with a field for the variable $month and point the action to a page containing the script. Try all the cases and see the result for the value of $month = 08 and $month = 09. And try also to input "00" or "any string". For god sake I want to know what's wrong with this code ? Reproduce code: --------------- <? switch ($month){ case (01): $mon="jan"; break; case (02): $mon="feb"; break; case (03): $mon="mar"; break; case (04): $mon="apr"; break; case (05): $mon="may"; break; case (06): $mon="jun"; break; case (07): $mon="jul"; break; case (08): $mon="aug"; break; case (09): $mon="sep"; break; case (10): $mon="oct"; break; case (11): $mon="nov"; break; case (12): $mon="dec"; break; default: print "INVALIDE MONTH !!"; } echo ($mon); echo ($month); ?> Expected result: ---------------- I expect to see a logical output regarding to the simple code above, I want to see the script printing "aug08" when I insert the value "08" for the month in the form. same thing for "09". and when we put "00", "any string" or BLANK the output is "aug + USED_STRING" Why all other values work fine ? Actual result: -------------- Actually, when we input $month = 08 the result is "WRONG MONTH08" even though the case was correctly predicted in the code. Same thing for "09". Does PHP have any problem with August and September ?