Recent projects have such a requirement for arrays. The contents of the array itself may keep changing. If you know a certain key name of the array, how to get the next key name?
At first I thought it would be difficult to write, so I kept looking for array-related functions in books and searching online, but found none.
So I started writing it myself, and I didn’t expect it to be so easy.
[html]
/*
* Find the next key name of the current key name in the array
* $array array
* $keys Current key name
* Return the next key name
*/
function next_array($array,$keys){
$n=0;
foreach($array as $key =>$value){
if($n==1)
return $key;
if($key == $keys)
$n++;
}
}
I found that many times, you still have to rely on yourself.
http://www.bkjia.com/PHPjc/477630.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477630.htmlTechArticleRecent projects need to have such a requirement for arrays. The content of the array itself may continue to change. If you know some of the array A key name, how to get the next key name? At the beginning...