经过几个小时的混乱,出汗和拔头发后,我仍然无法访问这些值。我想遍历第一级数组,这很简单,有一个基本的“foreach”循环,但我似乎无法进入第二个子数组上的“['合适性']”数组。我环顾四周,但除了似乎没有深入研究循环的真正基本数组教程之外似乎什么都没有。
我正在尝试访问嵌套/子数组中的值,即'['Species_name']'。
我不想使用关联键,因为排序有点问题。
Array
(
[0] => Array
(
[id] => 1
[name] => Bradeley Hall Pool
[postcode] => CW1 5QN
[lat] => 53.10213
[lon] => -2.41069
[size] => 1.60
[pegs] => 21
[distance] => 26.6
)
[1] => Array
(
[id] => 2
[name] => Farm Pool
[postcode] => CW9 6JQ
[lat] => 53.320502
[lon] => -2.549049
[size] => 0.88
[pegs] => 8
[distance] => 15.4
[suitability] => Array
(
[0] => Array
(
[fk_water_id] => 2
[fk_species_id] => 4
[species_name] => Barbel
[species_rating] => 1
[record_id] => 1
[weight_kg] => 2.721554
[length_cm] => 40
[height_cm] => 30
)
)
)
)