When I use
echo $stores_open_starts["tuesday"];
or
echo $stores_open_starts['tuesday'];
I get
11.00
Now, I want to use this dynamically. I generate the day like this:
$today_date = date('d', strtotime("today"));
$today_date = strtolower($today_date);
But then when I do
echo $stores_open_starts["{$today_date}"];
or
echo $stores_open_starts[$today_date];
it doesn't work. What am I doing wrong?
$stores_open_starts["{$today_date}"]means that you want to print an array element with index equals to$today_datevalue. did your array contains that index?echo($today_date);to check it's the value you expected?l(lower case L) instead ofddate('l')will returnTuesdayand it appears you wanttuesday.