array_values

array_values

(PHP 4, PHP 5, PHP 7)

array_valuesReturn all the values of an array

Description

array array_values ( 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

Example #1 array_values() example

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

The above example will output:

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

See Also

  • 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

© 1997–2017 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://secure.php.net/manual/en/function.array-values.php

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部