Php array small functions. Recently, the project needs to have such a requirement on the array. the content of the array may change constantly. if you know a key name of the array, how can you get the next key name? At the beginning, there was a need for arrays in recent projects. the content of the array may change constantly. if you know a key name of the array, how can you get the next key name?
At the beginning, I thought it would not be easy to write. I kept searching for array-related functions in the book and searching the internet. I found none of them.
So I did not expect it to be easy to write.
[Html]
/*
* Find the next key of the current key name of the 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 ++;
}
}
It is often found that you have to rely on yourself.
Why? At the beginning...