Hello forums !!
Case:
I had the array as:
I would like to find the next and previous key in the array according to the status. iePHP Code:$array = array(1 => array('key1' => 'xxx', 'status' => 'Y'), 2 => array('key1' => 'yyy', 'status' => 'N'), 3 => array('key1' => 'zzz', 'status' => 'N')...);
How to accomplish this type of array manipulation??PHP Code:function getNextKey(){
//should return the 2 as 1 key has status Y (Yes)
// if 1 key has status 'N' then it should return 1 key
}
function getCurrentKey(){
// should return 1
// if 2 key too had status 'Y' then it should return 2
}
function getPrevkey(){
// should return null
// if 2 key too had status 'Y' then it should return 1
}
Thanks in advance for the valueable help.


Reply With Quote

Bookmarks