-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay_09_switch_statement_02.php
More file actions
44 lines (39 loc) · 1.06 KB
/
Copy pathDay_09_switch_statement_02.php
File metadata and controls
44 lines (39 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/*
Write a function, returnSeason(). Your function should take in a string representing a month (e.g. "January"), and it should return which season that month falls in.
----------->"December", "January", and "February" are "winter" months.
----------->"March", "April", and "May" are "spring" months.
----------->"June", "July", and "August" are "summer" months.
And "September", "October", and "November" are "fall" months.
*/
function returnSeason( $month ) {
switch ( $month ) {
case "December":
case "January":
case "February":
return "winter";
case "March":
case "April":
case "May":
return "spring";
case "June":
case "July":
case "August":
return "summer";
case "September":
case "October":
case "November":
return "fall";
default:
return "Invalid";
}
}
echo returnSeason( "February" );
echo "<br/>";
echo returnSeason( "April" );
echo "<br/>";
echo returnSeason( "August" );
echo "<br/>";
echo returnSeason( "October" );
echo "<br/>";
echo returnSeason( "dfalfas;" );