September 2001
Intermediate to advanced
768 pages
32h 45m
English
array array_values(array array) Returns all values from an array.
Returns:
Indexed array containing all values from another array; NULL on failure
Description:
This function simply returns an indexed array in which each element is the corresponding element from array . The returned array is consecutively indexed starting from 0; all keys from the original array are ignored.
One use for this function is to quickly collapse an array that has had some elements unset using unset() into a freshly-ordered indexed array with no blank entries.
Version:
PHP 4
Example:
$array = array(1, 2, 3, 5, 7, 11, 13, 17, 19, 23); unset($array[3]); unset($array[7]); echo "Original array:\n"; print_r($array); $arr2 = array_values($array); ... |
Read now
Unlock full access