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

How to get the value in the array in php

藏色散人
藏色散人Original
2019-10-09 09:37:182910browse

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)

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));
?>

Output:

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

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!

Statement:
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