This article introduces the usage of the array_keys() function in PHP arrays. Friends in need can refer to it.
In php array functions, array_keys() function returns an array containing all the keys found in the searched array. The form is as follows: array array_keys(array array[,mixed search_value]) If the optional parameter search_value is included, only keys matching that value will be returned. Example that will output all arrays found in the $fruit array: <?php $fruits["apple"] = "red"; $fruits["banana"] = "yellow"; $fruits["watermelon"]="green"; $keys = array_keys($fruits); print_r($keys); //by bbs.it-home.org //Array ( [0] => apple [1] => banana [2] => watermelon ) ?> Copy after login |