PHP array_values() Function

PHP array_values Function


Definition 

PHP array_values() is inbuilt function that returns an array containing all the values of an array.

The returned array will be indexed numerically, starting with 0 and increase each time by 1.

Syntax

The basic syntax of the array_values() function is given with:

    array_values(array);

Parameters

The array_values() function accepts the following parameters.

Parameter Description
array Required. Specifies the array to work on.

Example1 : we can see below example return all the value of an array(not the keys)

 

Output : 

Array
(
    [0] => Web
    [1] => Designing
    [2] => House
)

Example2 :This function may ignore the numeric indexes, let's try out an example 

Output : 

Array
(
    [0] => Web
    [1] => Designing
    [2] => House
    [3] => Online
    [4] => 100
)