{% else-1 %}

                        
<?php
function currentSeason($winter = null, $spring = null, $summer = null, $autumn = null)
{
$month = (new DateTime)->format('n');
if (in_array($month, [12, 1, 2])) {
return $winter;
} elseif (in_array($month, [3, 4, 5])) {
return $spring;
} elseif (in_array($month, [6, 7, 8])) {
return $summer;
} elseif (in_array($month, [9, 10, 11])) {
return $autumn;
}
}
echo currentSeason('зима', 'весна', 'лето', 'осень');
1 318 0
0

Нет фото
• 22 окт 2015, 20:13


читабельный вид https://gist.github.com/odoveiz/19d33e0b05318bb255f7