开发者

Help with big array

I have this array:

$array_lugares = array
(
    array("barra"=>array
        (
            /*SENTIDO BARRA*/
            "Sao conrado"=>array("-22.999743","-43.270694"),
            "Elevado do Joa"=>array("-22.999429","-43.27317")
        ),
        "zona sul"=>array
   开发者_StackOverflow     (
            /*SENTIDO ZONA SUL:*/
            "passarela barra"=>array("-23.008346","-43.303708"),
            "barra grill"=>array("-23,010576", "-43,302028"),
            "lagoa barra"=>array("-22,997348", "-43,263200")
        ),
        "recreio"=>array(
            /*SENTIDO RECREIO:*/
            "passarela barra"=>array("-23.008283","-43.303634"),
            "rio mar"=>array("22.999958","-43.402648"),
            "ribalta"=>array("-22,999753", "-43,409211")
        )
    )
);

I'm trying to make it so i get a string, if strpos finds 'barra' it tries to fin 'sao conrado' or 'elevado do joa' if it finds it it returns it's coordinates, is there a better way to do it ? this is the best I could do but I don't think this is the best way to do it because it will have to loop everytime to find 'barra', 'recreio', etc

help


Try something like this:

if(isset($array_lugares[0]['barra']['Sao conrado']))
{
    //Exists
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜