I am trying to keep a PHP webpage which is just one simple:
"Hi, today is a good week of its ___ day!" "Hi, today it's a good weekend of ___ day!"
I have an ATM code (at some points there is a regret for random Swedish):
Setlokel (LCTIPIE, 'English'); $ Day = strftime ('% A', time ()); $ Week = array ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"); If ($ day & lt; "Saturday"); {Echo "Idga Ar Date" $ Day "O N Traveling Ward!"; } And if ($ day> "Friday"); {Echo "Ida er date" $ day "Hey en Traveling Helga!"; } And ($ day = "Sunday"); {Echo "Idga Ar Date" $ Day "O N Traveling Wake!"; }
First of all, no need to create an array here to work together is not . Simply use the datetime object. You should be able to simplify it:
$ datetime = new dateTime (); // day of week get string $ message = "IDEg er date" $ Datetime- & gt; Format ('l'); // Get the day of week number day number 1 (Monday) - 7 (Sunday) $ day_of_week_number = (int) $ datetime- & gt; Format ('N'); Switch ($ day_of_week_number) {Case 7: $ Message. = 'Ha N Trevolga Wakka!'; break; Case 6: $ message. = 'Hey Nah! break; Default: $ message. = 'Hey en Traveling verdict!'; break; } $ Message echo;
Comments
Post a Comment