Home > Backend Development > PHP Problem > How to get the value in the array in php

How to get the value in the array in php

藏色散人
Release: 2023-02-25 20:50:01
Original
2981 people have browsed it

How to get the value in the array in php

#How to get the value in the array in php?

array_values ​​definition and usage

array_values() function returns an array containing all key values ​​​​in the given array, but does not retain the key names.

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

Syntax

array_values(array)
Copy after login

Parameters

array required. Specifies an array.

Return all values ​​(non-key names) of the array:

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

Output:

Array ( [0] => Bill [1] => 60 [2] => USA )
Copy after login

For more PHP knowledge, please visit PHP Chinese website!

The above is the detailed content of How to get the value in the array in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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