array_values
Returns all values from an array with numeric keys, effectively reindexing the array.
Parameters
main.php
Return Values
array
Returns indexed array with all values from input array
On success:Array with numeric keys starting from 0
On failure:Empty array if input array is empty
Notes
- Removes all original keys and creates new numeric keys
- Useful after array_filter to get continuous numeric indexes
- Essential for converting associative arrays to indexed arrays
- Commonly used before JSON encoding for arrays
Changelog
- Function has been available since PHP 4.0.0
Related Functions
str_replace
StringReplaces all occurrences of search string with replacement string.
replacesanitizeclean
trim
StringReturns a string with whitespace (or other characters) stripped from the beginning and end of string.
cleanwhitespacesanitize