prova a vedere se ti piace anche così!
Codice PHP:
//$h è la variabile relativa all'ora, $d relativa al giorno!
function what($h,$d) {
if ($h>=0 && $h<=8) {
return "is now sleeping";
} elseif ($d>=1 && $d<=5) {
if ($h>=9 && $h<=18) {
return "is now working";
}
if ($h>=19 && $h<=23) {
return "is now playing videogames";
}
} elseif ($d==6 || $d==0) {
return "is now relaxing";
} else {
return "nothing";
}
}