php array_values ​​returns all values ​​of the array detailed explanation and examples

黄舟
Release: 2023-03-06 06:06:01
Original
1772 people have browsed it

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

array_values() Returns all the values ​​in the input array and creates numbers for them index.

Parameter introduction:

##ParameterDescription inputRequired. 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));
?>
Copy after login


Run result:


Array ( [0] => php code [1] => html code [2] => css code [3] => js code )
Copy after login
The above is the array returned by php array_values All value details and examples are included. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!