www.webdeveloper.com
Results 1 to 2 of 2

Thread: how to manipulate this array ??

  1. #1
    Join Date
    Feb 2007
    Posts
    84

    how to manipulate this array ??

    Hello forums !!
    Case:
    I had the array as:
    PHP Code:
    $array = array(=> array('key1' => 'xxx''status' => 'Y'), => array('key1' => 'yyy''status' => 'N'), => array('key1' => 'zzz''status' => 'N')...); 
    I would like to find the next and previous key in the array according to the status. ie
    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

    How to accomplish this type of array manipulation??
    Thanks in advance for the valueable help.

  2. #2
    Join Date
    Aug 2006
    Location
    Michigan
    Posts
    1,046

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles