How to get the maximum subscript of an array in PHP
This article mainly introduces the method of getting the maximum subscript of an array in PHP, involving the operation of arrays by functions such as max and array_search in PHP Tips, friends in need can refer to it
The example in this article describes the method of obtaining the maximum subscript of an array in PHP. Share it with everyone for your reference. The specific implementation method is as follows:
?
1
2
3
4
5
|
$hots = array('8213'=> 0,'8212'=> 100,'8172'=> 10008);
$key = array_search(max($hots),$hots);
echo $key;
?>
|
1
2
3
4
5
|
$hots = array('8213'=> 0,'8212'=> 100,'8172'=> 10008);
$key = array_search(max($hots),$hots);
echo $key;
?>
|
The running result is: 8172
http://www.bkjia.com/PHPjc/1000118.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1000118.htmlTechArticleHow to get the maximum subscript of an array in PHP This article mainly introduces the method of getting the maximum subscript of an array in PHP, involving Relevant skills for operating arrays with functions such as max and array_search in php, required...
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