array_keys
Returns all keys or a subset of keys from an array, optionally filtered by value.
Parameters
main.php
Return Values
array
Returns an array of all keys from the input array
On success:Array containing all keys or keys matching search_value
On failure:Empty array if no matches found
Notes
- Without search_value, returns all keys from the array
- With search_value, returns only keys where value matches
- Use strict parameter for type-safe comparisons
- Useful for array manipulation and key extraction
Changelog
- 5.0.0: strict parameter added
Related Functions
substr
StringReturns a portion of a string specified by start and length parameters.
substringextractslice
array_column
ArrayReturns the values from a single column in a multi-dimensional array or array of objects.
extractcolumndatabase
array_slice
ArrayExtracts a slice of an array based on offset and length parameters without modifying the original array.
sliceextractpagination