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 −

Live Demo

<?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 
)

Updated on: 30-Jul-2019

44 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements