I have an array that looks like this in var_dump.
array (size=3)
0 =>
array (size=2)
0 =>
array (size=1)
'08:40:00' => string '8:40 am' (length=7)
1 =>
array (size=1)
'09:00:00' => string '9:00 am' (length=7)
1 =>
array (size=5)
0 =>
array (size=1)
'12:00:00' => string '12:00 pm' (length=8)
1 =>
array (size=1)
'12:20:00' => string '12:20 pm' (length=8)
2 =>
array (size=1)
'12:40:00' => string '12:40 pm' (length=8)
3 =>
array (size=1)
'13:00:00' => string '1:00 pm' (length=7)
4 =>
array (size=1)
'13:20:00' => string '1:20 pm' (length=7)
Whats the best way to loop through this array to access the 2nd level elements (the clock times), WITHOUT assuming the sizeof the main array (currently 2).
Yes i'm seeking code assistance, but most examples on google are for arrays with string indexes like testarray['breakfasttimes'] and testarray['lunchtimes'].
foreach
insideforeach
? – asprin May 5 at 10:13$array['foo']
access the foo key, whereas$array[0]
accesses the value of the 0 index... – Elias Van Ootegem May 5 at 10:25