目标是提取最低、中、高距离。 最低距离已经成功实现。 然而,中、高距离则更为复杂。
Array content is shown below: Array name: $array
Array
(
[0] => Array
(
[city] => Array
(
[0] => Reduit
[1] => Curepipe
)
[distance] => 200
)
[1] => Array
(
[city] => Array
(
[0] => Array
(
[0] => Reduit
[1] => Ebe
)
[1] => Bees Village
[2] => Phoen Trunk Rd
[3] => Riv,Phoenix
[4] => St l Rd
[5] => Geoes Guibert St
[6] => Curepipe
)
[distance] => 151
)
[2] => Array
(
[city] => Array
(
[0] => Array
(
[0] => Reduit
[1] => Riv,Phoenix
)
[1] => St l Rd
[2] => Geoes Guibert St
[3] => Curepipe
)
[distance] =>50
)
[3] => Array
(
[city] => Array
(
[0] => Array
(
[0] => Reduit
[1] => Ebene
)
[1] => Belles Village
[2] => Phoenix Trunk Rd
[3] => Riverside,Phoenix
[4] => St Paul Rd
[5] => Georges Guibert St
[6] => Curepipe
)
[distance] => 101
)
)
有人能告诉我哪里出错了吗?
$current = $array[0][ distance ];
for($middleDistance=1;$middleDistance<$total;$middleDistance++){
$next = $array[($middleDistance)][ distance ];
if ($next<$current){
$current = $next;
print_r($current);
if($current>50&&$current<100){
}
}
}