PHP Array_values ​​() Function

PHP

Syntax :
array array_values ​​($array)
Parameters:this function takes only one parameter $array, which is required and refers to the original input array from which to extract values.Return value:this function returns an array with the selected values, indexed with the numeric keys.Examples:
Input: $array = ("ram" = > 25, "krishna" = > 10, " aakash "= > 20," gaurav ") Output: Array ([0] = > 25 [1] = > 10 [2] = > 20 [3] = > gaurav) Input: $array = ( "ram", "krishna", "aakash", "gaurav") Output: Array ([0] = > ram [1] = > krishna [2] = > aakash [3] = > gaurav)
The following program illustrates the array_values ​​() function in PHP: // PHP function to illustrate the use of arr ay_values ​​() function Return_Values ​​( $array ) { return ( array_values ​​ ( $array )); } $array = array ( "ram" = > 25, "krishna" = > 10, "aakash" = > 20, "gaurav" ); print_r (Return_Values ​​( $array ) ); ?> Output:
Array ([ 0] = > 25 [1] = > 10 [2] = > 20 [3] = > gaurav)
Link :
http://php.net/manual/en/function.array-values.php



Tutorials