搜索数组中的最高键/索引 [英] Search for highest key/index in an array
本文介绍了搜索数组中的最高键/索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在带有 最高 key/index
="显示标记为 'php' 的问题" rel="tag">php?我知道如何为价值观做到这一点.
How can I get the highest key/index
in an array with php? I know how to do it for the values.
例如:从这个数组中我想得到 10
作为 integer
值:
E.g.: from this array I would like to get 10
as an integer
value:
$arr = array(1 => "A", 10 => "B", 5 => "C");
我知道如何编写代码,但我问自己是否也有此功能.
I know how I could code it but I was asking myself if there is a function for this as well.
推荐答案
这应该没问题
$arr = array( 1 => "A", 10 => "B", 5 => "C" );
max(array_keys($arr));
这篇关于搜索数组中的最高键/索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文