switch statement: check for multiple values[SOLVED]
Posted: Wed Aug 31, 2005 11:42 am
I am trying to write a function which would return the number of days in a month.
I am trying to match $this->month(a month value, numeric or string) with multiple values in a case.
If I give 1,2 or FEB it return 31 all the time.
2. Is there a function to get the day(like mon, tue, wed) for the first day in the month??? 
I am trying to match $this->month(a month value, numeric or string) with multiple values in a case.
If I give 1,2 or FEB it return 31 all the time.
Code: Select all
function findDaysOfMonth(){
echo "current month:".$this->month;
switch($this->month){
case ("JAN" || "JANUARY" || 1):
return 31;
break;
case ("FEB" || "FEBRUARY" || 2):
if ($this->year%4 == 0){
return 29;
}else{
return 28;
}
break;
case ("MAR" || "MARCH" || 3):
return 31;
break;
case ("APR" || "APRIL" || 4):
return 31;
break;
}
}