Last active
March 21, 2023 15:18
-
-
Save SilasRodrigues19/830783ece1c0d7c011f6f31700249162 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('America/Sao_Paulo'); | |
$currentDate = new DateTime(); | |
$currentHour = $currentDate->format('H'); | |
$currentMinutes = $currentDate->format('i'); | |
if ($currentHour >= 5 && $currentHour < 12) { | |
$message = "tenha um bom dia"; | |
} elseif ($currentHour >= 12 && $currentHour < 18) { | |
$message = "tenha uma boa tarde"; | |
} else { | |
$message = "tenha uma boa noite"; | |
} | |
echo "Agora são {$currentHour}:{$currentMinutes}, {$message}"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment