Reputation: 980
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?
Upvotes: 0
Views: 34
Reputation: 2104
I think you want the full day of the week as a string. That's:
$today_date = date('l', strtotime("today")); //You should use 'l' and not 'd'
$today_date = strtolower($today_date);
'd'
returns the day of the month, not the name of the weekday.
Upvotes: 3