Computer >> Computer tutorials >  >> Programming >> PHP

array_values() function in PHP


The array_values() function returns all the values of an array.

Syntax

array_values(arr)

Parameters

  • arr − the specified array.

Return

The array_values() function returns the values of an array.

Example

The following is an example −

<?php
   $arr = array("ID"=>"001","Name"=>"Amit","Department"=>"Programming", "Zone"=>"North");
   print_r(array_values($arr));
?>

Output

Array ( 
   [0] => 001 
   [1] => Amit 
   [2] => Programming 
   [3] => North 
)