PHP array_values() Function

The array_values() function is used to fetch all the values from an array.

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

Returns an array containing all the values of an array

Parameter Description
array Required. Specifying an array

Syntax

array_values(array) 

Example

$array = array("Name"=>"Cooper","age"=>"27");
print_r(array_values($array));

Output

Array ( [0] => Cooper [1] => 27 ) 

Leave a Reply

Your email address will not be published. Required fields are marked *