I am try to create a condition where condition should check the presence of locality or zip code in Multidimensional array, if any one condition is satisfied, its should return true or else false
here is the code i tried with a array
$cars = array("locationabc","locationdef","locationdghi");
$locality = "locationabc";
if ( in_array($locality, $cars) ) {
echo "you can proceed service to your location";
}else {
echo "sorry we don't provide service to your location";
}
but how to do that in multidimensional array, i don''t know whether the below condition is right or wrong
$cars = array
(
array("locationabc",500001),
array("locationdef",500002),
array("locationdghi",500003)
);
$locality = "locationabc";
if ( array_key_exists($locality, $cars) ) {
echo "you can proceed service to your location";
}else {
echo "sorry we don't provide service to your location";
}