Home > Backend Development > PHP Tutorial > Detailed explanation of php array_values ​​return array value instance

Detailed explanation of php array_values ​​return array value instance

高洛峰
Release: 2023-03-03 13:58:01
Original
1445 people have browsed it

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 numerical index for it.

Parameter introduction:

Detailed explanation of php array_values ​​return array value instance

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));
?>
Copy after login

Run result:

Array ( [0] => php code [1] => html code [2] => css code [3] => js code )


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template