php8.5
Home/ Manual/ array / functions/ array_values

array_values

PHP function Edit on GitHub ✎

(PHP 4, PHP 5, PHP 7, PHP 8)

Return all the values of an array

Description

array_values(array $array): array

array_values() returns all the values from the array and indexes the array numerically.

Parameters

array

The array.

Return Values

Returns an indexed array of values.

Examples

array_values() example

php
<?php
$array = array("size" => "XL", "color" => "gold");
print_r(array_values($array));
?>

The above example will output:

output
Array
(
    [0] => XL
    [1] => gold
)

See Also

Source: reference/array/functions/array-values.xml · from the official PHP manual (php/doc-en)