PHP array_values()Functions
Complete PHP Array Reference Manual
Examples
Return all the values of an array (not preserving the keys):
<?php
$a=array("Name"=>"Peter","Age"=>"41","Country"=>"USA");
print_r(array_values($a));
?>
$a=array("Name"=>"Peter","Age"=>"41","Country"=>"USA");
print_r(array_values($a));
?>
Run Example »
Definition and Usage
The array_values() function returns an array containing all the values of the array.
Tip:The returned array will use numeric keys, starting from 0 and increasing by 1.
Syntax
array_values(array)
| Parameter | Description |
|---|---|
| array | Required. Specifies an array. |
Technical Details
| Return Value: | Returns an array containing all the values of the array. |
|---|---|
| PHP Version: | 4+ |
Complete PHP Array Reference Manual Other Extensions