In PHP we can associate name/label with each array elements using => symbol. This is very helpful as it is easy to remember the element because each element is represented by the label rather than the index value.
Using array_keys() function: The array_keys() function is an inbuilt function in PHP which is used to return either all the keys of an array or the subset of the keys.
array array_keys( $input_array, $search_value, $strict )
Program 1: Program to get numeric index of associative array using array_keys() function.
Example 2: Below program uses index to access the values in associative array.
- How to access an associative array by integer index in PHP?
- How to loop through an associative array and get the key in PHP?
- Numeric Control (NC) and Computer Numeric Control (CNC)
- Convert Factor to Numeric and Numeric to Factor in R Programming
- Convert an object to associative array in PHP
- Iterate associative array using foreach loop in PHP
- How to check an array is associative or sequential in PHP?
- PHP program to add item at the beginning of associative array
- How to remove a key and its value from an associative array in PHP ?
- Multidimensional Associative Array in PHP
- Associative Arrays in PHP
- How to merge the first index of an array with the first index of second array?
- PHP | ctype_digit() (Checks for numeric value)
- How to re-index an array in PHP?
- PHP | Get PHP configuration information using phpinfo()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.