Php tips form a new array by exchanging the keys and values of the array, and obtain the key by searching for the value. The copy code is as follows: $ citynamearray_flip ($ city_DB [name]); a new array is formed by exchanging the keys and values of the array $ city_namearray_search ($ city_id, $ cityname, true ); retrieve search value
The code is as follows:
$ Cityname = array_flip ($ city_DB [name]); // exchange the keys and values of the array to form a new array.
$ City_name = array_search ($ city_id, $ cityname, true); // Obtain the key for the search value
The http://www.bkjia.com/PHPjc/323421.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/323421.htmlTechArticle code is as follows: $ cityname = array_flip ($ city_DB [name]); // exchange the keys and values of the array to form a new array $ city_name = array_search ($ city_id, $ cityname, true); // obtain the search value...