I have been making a clock which displays schedules based on which day it is so I have created 7 arrays with schedules in them. Now I need to write a foreach statement that takes the date:
$day = date("D");
Then uses the foreach function on that array like:
foreach ($day as &$value) {
}
When I do this though it gives me an error because it wants me to use the direct array variable.
Warning: Invalid argument supplied for foreach() in /home/johfin16/johnfinberg.com/php/functions-new.php on line 24
Here is an example of one of my arrays.
$Mon = array("08:10am-08:30am-Morning Meeting",
"08:35am-09:55am-A Block",
"10:05am-11:25am-B Block",
"11:30am-12:05pm-First Lunch",
"12:05pm-12:40pm-Second Lunch",
"12:40pm-02:00pm-C Block",
"02:05pm-03:25pm-D Block");
Is there a way to work around this without creating a bunch of if statements?
$dayisn't an array, it's a string.foreachwhen there's just one day?error_reporting(E_ALL); ini_set('display_errors', 1);at the top of yourphpscript, what does it return?