array_values

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

array_valuesReturn all the values of an array

Опис

array_values(array $array): array

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

Параметри

array

The array.

Значення, що повертаються

Returns an indexed array of values.

Приклади

Приклад #1 array_values() example

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

Поданий вище приклад виведе:

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

Прогляньте також

  • array_keys() - Return all the keys or a subset of the keys of an array
  • array_combine() - Creates an array by using one array for keys and another for its values