PHP array_values() Function

Example

Return all values of the array (non-key names):

<?php
$a=array("Name"=>"Bill","Age"=>"60","Country"=>"USA");
print_r(array_values($a));
?>

Run Instance

Definition and Usage

The array_values() function returns an array containing all the keys of the given array, but does not retain the key names.

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: Return an array containing all the values of the array.
PHP Version: 4+