PHP array_values() Function

PHP array_values() Function is used to get all value of array. PHP array_values() function is PHP built-in function.

Syntax :

array_values(array $array);

Parameter,

$array : Required. It is input array.

Return : It returns array containing all values of an array. The returned array will have numeric keys which is starting at 0 and increase by 1.

Let's see below example to understand php array_values() Function in details.

Example :

<?php
$array=array("Gujarat"=>"Gandhinagar","Maharashtra "=>"Mumbai","Madhya Pradesh"=>"Bhopal","Goa"=>"Panaji");
echo "<br>It returns array containing the all values of ".'$array <br>';
$array_values = array_values($array);
print_r($array_values);
?>

Output :

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

91373