php array_values
php The array_values function is used to return all the values in the array. Note that this function will create an array index for the new array, and the original text index will not exist. This article explains to you the basic syntax and usage examples of the array_values function.
array_values Returns all the values in the array
Basic syntax:
array array_values ( array $input )
array_values() Returns all the values in the input array and creates numbers for them index.
Parameter introduction:
Description | |
---|---|
Required. Specifies an array. |
Return value:
Returns the index array containing all values.
Note:
All of the new array returned will be numerically indexed, starting from 0.
Example:
<?php $array = array( "php" => "php code", "html" => "html code", "css" => "css code", "js" => "js code", ); print_r(array_values($array)); ?>
Run result:
Array ( [0] => php code [1] => html code [2] => css code [3] => js code )