Php Array Values Display Function

What is array_values Function?

Explanation

The "array_values" function returns all the value of an array.

Syntax:


array_values(array)

In the above syntax "array" is the array from which all the values are displayed, but the keys will be numeric starting with 0.

Example :


<?php
$a=array("a"=>"Orange","b"=>"Guava","c"=>"Apple");
print_r(array_values($a));
?>
Result :

Array ( [0]=> Orange [1]=> Guava [2]=> Apple);

In the above example all the values of array "$a" is displayed, with numeric keys starting from "0".

PHP Topics


Ask Questions

Ask Question