How to loop through an associative array and get the key? 2009年12月23日 - If you use array_keys() , PHP will give you an array filled with just the keys: ... The following will allow you to get at both the key and value at the ...
php - Iterate through array and get key and value - Stack ... 2010年9月20日 - I´d go for a recursive function: If a value is an array, call it again and otherwise display the key / value pair. Something like (not tested): function ...
Fetch a key from an array - PHP ... array &$array ). key() returns the index element of the current array position. ... Note that using key($array) in a foreach loop may have unexpected results.