THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

PHP array_values() Function

PHP Array Reference PHP Array Reference

Example

Return all the values of an array (not the keys):

<?php
$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 an array.

Tip: The returned array will have numeric keys, starting at 0 and increase by 1.


Syntax

array_values(array)

Parameter Description
array Required. Specifying an array

Technical Details

Return Value: Returns an array containing all the values of an array
PHP Version: 4+

PHP Array Reference PHP Array Reference