functie-om-een-seizoen-terug-te-geven
Gesponsorde koppelingen
PHP script bestanden
Code (php)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
function getSeason($day, $month, $year)
{
$seasons = array(
'1' => array
(
2008 => array('day'=>21)
),
'2' => array
(
2008 => array('day'=>21)
),
'3' => array
(
2008 => array('day'=>21)
),
'4' => array
(
2008 => array('day'=>21)
)
);
switch ($month)
{
case 1:
case 2:
$season = 2;
break;
case 3:
if ( $day >= $seasons[2][$year]['day'])
{
$season = 2;
}
else
{
$season = 1;
}
break;
case 4:
case 5:
$season = 'spring';
break;
case 6:
if ( $day >= $seasons[3][$year]['day'])
{
$season = 3;
}
else
{
$season = 2;
}
break;
case 7:
case 8:
$season = 3;
break;
case 9:
if ( $day >= $seasons[4][$year]['day'])
{
$season = 4;
}
else
{
$season = 3;
}
break;
case 10:
case 11:
$season = 4;
break;
case 12:
if ( $day >= $seasons[1][$year]['day'])
{
$season = 1;
}
else
{
$season = 4;
}
break;
}
return $season;
}
?>
function getSeason($day, $month, $year)
{
$seasons = array(
'1' => array
(
2008 => array('day'=>21)
),
'2' => array
(
2008 => array('day'=>21)
),
'3' => array
(
2008 => array('day'=>21)
),
'4' => array
(
2008 => array('day'=>21)
)
);
switch ($month)
{
case 1:
case 2:
$season = 2;
break;
case 3:
if ( $day >= $seasons[2][$year]['day'])
{
$season = 2;
}
else
{
$season = 1;
}
break;
case 4:
case 5:
$season = 'spring';
break;
case 6:
if ( $day >= $seasons[3][$year]['day'])
{
$season = 3;
}
else
{
$season = 2;
}
break;
case 7:
case 8:
$season = 3;
break;
case 9:
if ( $day >= $seasons[4][$year]['day'])
{
$season = 4;
}
else
{
$season = 3;
}
break;
case 10:
case 11:
$season = 4;
break;
case 12:
if ( $day >= $seasons[1][$year]['day'])
{
$season = 1;
}
else
{
$season = 4;
}
break;
}
return $season;
}
?>