【发布时间】:2011-06-20 06:58:05
【问题描述】:
我有一个数组
Array(1=>'test',9=>'test2',16=>'test3'... and so on);
我如何通过传递密钥来获取下一个数组项。
例如,如果我有密钥 9,那么我应该得到 test3 作为结果。如果我有1 那么它应该返回'test2' 作为结果。
编辑使其更清晰
echo somefunction($array,9); //result should be 'test3'
function somefunction($array,$key)
{
return $array[$dont know what to use];
}
【问题讨论】:
-
我认为这是重复的。检查这个问题 -> stackoverflow.com/questions/6141717/…
标签: php