+ 1

What's the problem in this?

<?php $today = ('Mon','Tue','Wed','Thu','Fri','Sat','Sun'); foreach($today as $tday){ switch ($tday) { case "Mon": echo "Today is Monday."; break; case "Tue": echo "Today is Tuesday."; break; case "Wed": echo "Today is Wednesday."; break; case "Thu": echo "Today is Thursday."; break; case "Fri": echo "Today is Friday."; break; case "Sat": echo "Today is Saturday."; break; case "Sun": echo "Today is Sunday."; break; default: echo "Invalid day."; } } ?>

6th Mar 2016, 6:36 AM
Varun Sharma
Varun Sharma - avatar
8 Antworten
+ 4
you left out the key word array in your array declaration.$today=array(,,,_)
11th Mar 2016, 10:05 PM
Ayaah Silas
+ 4
demasiado excelente
29th Aug 2016, 2:30 AM
JDL
JDL - avatar
+ 3
for each need an array
23rd Dec 2016, 6:06 PM
Andreas Heil
Andreas Heil - avatar
+ 2
you should write $today=array ('Mon','Tue','Wed','Thu','Fri','Sat','Sun,); Then you will get the output
18th Jun 2016, 3:06 AM
saikamal
saikamal - avatar
0
$today = array('Mon'... and so on. u forgot "array"
20th Apr 2016, 6:51 PM
Mark Lee
Mark Lee - avatar
0
Space between items in array(stay)..
26th Apr 2016, 11:40 PM
eg X hero
eg X hero - avatar
0
$today=array
1st Oct 2016, 11:02 AM
vijay sonavane
vijay sonavane - avatar
0
email me if you don't mind (aes249801@gmail.com)
18th Apr 2017, 1:31 AM
Abdullrahman Elsayed
Abdullrahman Elsayed - avatar