PHP » Arrays » array_values()

Syntax:
array array_values(array array)
array
array for which the values are wanted.

Returns the values of an associative array.

This function returns all values of an associative array. The result returned is in the form of an indexed array.

Examples

Code:
<?php

$array1 = array(
   "strawberry" => "red",
   "blueberry" => "blue",
   "raspberry" => "red");

// find colors
foreach (array_values($array1) as $color)
   print "$color ";

?>
Output:
red blue red
Explanation:

All the values in the associative array are printed.

See Also: