The php trick is to swap the keys and values of the array to form a new array

  • 2020-05-07 19:22:57
  • OfStack

 
$cityname = array_flip($city_DB[name]); // Swap the keys and values of the array to form a new array  
$city_name = array_search($city_id,$cityname,true); // Find the value to get the key  

Related articles: