PHP array_values
The PHP array_values function returns all the values in the array, noting that the function will set up an array index for the new array, and the original text index will not exist. This article explains the basic syntax and usages 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 a numeric index for them.
Parameter introduction:
Parameters |
Description |
Input |
Necessary. The specified array. |
return value:
Returns an array of indexes that contain all the values.
Attention:
All of the new array returned will use a numeric index, starting with 0.
Instance:
<?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)
Thank you for reading, I hope to help you, thank you for your support for this site!