Tutorials Point


  Learning PHP
  Advanced PHP
  PHP Function Reference
  PHP Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

PHP Function array_values()


previous

Advertisements

Syntax

array_values ( $array );

Definition and Usage

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

Paramters

ParameterDescription
arrayRequired. Specifies an array.

Example

Try out following example:

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

print_r(array_values($array));
?> 

This will produce following result:

Array
(
    [0] => green
    [1] => brown
    [2] => blue
    [3] => red
)

previous Printer Friendly

Advertisements


  

Advertisements