PHP array_values() Function
Definition
The array_values()
returns an array of all the values.
Syntax
PHP array_values() Function has the following syntax.
array array_values ( array arr )
Using the array_values()
function makes PHP create a new array where the indexes
are recreated and the values are copied from the old array.
Parameter
- array - Required. Specifying an array
Example
Returns an array of all the values
<?PHP//from w w w . j a v a 2 s . c om
$words = array("Z","A", "B", "C", "D", "java2s.com");
var_dump($words);
asort($words);
var_dump($words);
var_dump(array_values($words));
?>
The code above generates the following result.