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?
- Convert an object to associative array in PHP
- How to check an array is associative or sequential in PHP?
- Iterate associative array using foreach loop in PHP
- PHP program to add item at the beginning of associative array
- Associative Arrays in PHP
- How to re-index an array in PHP?
- Find the index of an array element in Java
- How to check whether a value is numeric or not using jQuery ?
- PHP | ctype_digit() (Checks for numeric value)
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.