I have the following array called $shops
:
Array
(
[0] => Array
(
[id] => 10
[open] => Array
(
[0] => Array
(
[day] => Monday
[start] => 09:00:00
[end] => 17:00:00
)
[1] => Array
(
[day] => Tuesday
[start] => 09:00:00
[end] => 17:00:00
)
[2] => Array
(
[day] => Thursday
[start] => 09:00:00
[end] => 17:00:00
)
)
)
)
When I loop through it similar to the following I get Illegal string offset 'day'
foreach($shops as $shop)
{
foreach($shop['open'] as $open)
{
print_r($open);
echo $open['day'];
}
}
The print_r($open)
appears correct:
Array
(
[day] => Monday
[start] => 09:00:00
[end] => 17:00:00
)
I must be doing something stupid. What's the problem?