.01
.02
.03
.04
.05
.06
.07
.08
.09
.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
|
|
<?php
/******************************************************************************/
/* */
/* __ ____ */
/* ___ / / ___ / __/__ __ _____________ ___ */
/* / _ \/ _ \/ _ \_\ \/ _ \/ // / __/ __/ -_|_-< */
/* / .__/_//_/ .__/___/\___/\_,_/_/ \__/\__/___/ */
/* /_/ /_/ */
/* */
/* */
/******************************************************************************/
/* */
/* Titre : Obtenir les Saisons */
/* */
/* URL : http://www.phpsources.org/scripts460-PHP.htm */
/* Auteur : PhpSources */
/* Date édition : 30 Sept 2008 */
/* Website auteur : http://www.phpsources.org */
/* */
/******************************************************************************/
function getSaison($hemisphere, $month=null)
{
$month = is_null($month) ? date('m') : $month;
// sud
$southern=array(
'summer' => array(12, 1, 2),
'autumn' => array(3, 4, 5),
'winter' => array(6, 7, 8),
'spring' => array(9, 10, 11)
);
// nord
$northern=array(
'summer' => array(6, 7, 8),
'autumn' => array(9, 10, 11),
'winter' => array(12, 1, 2),
'spring' => array(3, 4, 5)
);
// loop sur l'hemisphere
foreach($hemisphere as $key=>$val)
{
if(in_array($month, $val))
{
return $key;
}
}
return false;
}
// montre les saisons en decembre de l'hemisphere nord
echo getSaison('northern', 12);
?>
|