PHP array_values() Function

❮ 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));
?>
Try it Yourself »

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 Values

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
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.