Home > Backend Development > PHP Problem > Is php array value an array?

Is php array value an array?

藏色散人
Release: 2023-03-17 16:56:01
Original
3952 people have browsed it

php array value is not an array, but an array function. Its full function name is "array_values()", which is used to return an array containing all the values ​​in the array. The syntax is "array_values(array)" , where the parameter array specifies the array.

Is php array value an array?

The operating environment of this tutorial: windows10 system, PHP8.1 version, DELL G3 computer

php array value is an array?

php array value is not an array, but an array function.

array_values() function returns an array containing all the values ​​in the array.

Tip: The returned array will use numeric keys, starting from 0 and increasing by 1.

Syntax

array_values(array)
Copy after login

Parameters

array required. Specifies an array.

Example

Return all values ​​in the array (key names are not retained):

<?php
$a=array("Name"=>"Peter","Age"=>"41","Country"=>"USA");
print_r(array_values($a));
?>
Copy after login

Output:

Array ( [0] => Peter [1] => 41 [2] => USA )
Copy after login

Recommended learning: "PHP video tutorial

The above is the detailed content of Is php array value an array?. For more information, please follow other related articles on the PHP Chinese website!

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