PHP array_values function

Last Updated: February 17, 2022

array_values — Get the values of the array. Return values from the array and index them numerically

Syntax

array_values(array $array): array

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

Parameters

Parameter Description
array target array

Return Value

Returns numerical index array with values

Example

$array = array("one" => "One", "two" => "Two");
print_r(array_values($array));

Output

Array ( [0] => One [1] => Two ) 
Test