• PHP Video Tutorials

PHP - Function array_values()



Syntax

array_values ( $array );

Definition and Usage

This function returns all the values from the input array and indexes numerically the array.

Parameters

Sr.No Parameter & Description
1

array(Required)

It specifies an array.

Example

Try out following example −

<?php
   $input = array("a"=>"green", "b"=>"brown", "c"=>"blue", "red");
   
   print_r(array_values($input));
?> 

This will produce the following result −

Array ( [0] => green [1] => brown [2] => blue [3] => red )
php_function_reference.htm
Advertisements