Jump to content

Help with Multidimensional array


halebs

Recommended Posts

Have the following projects array.

 

Array

(

    [\0] => Array

        (

            [id] => 24

            [type] => p

        )

 

    [1] => Array

        (

            [id] => 23

            [type] => p

        )

 

    [2] => Array

        (

            [id] => 18

            [type] => p

        )

 

    [3] => Array

        (

            [id] => 6

            [type] => s

        )

 

    [4] => Array

        (

            [id] => 3

            [type] => s

        )

 

    [5] => Array

        (

            [id] => 8

            [type] => s

        )

 

)

 

I am wondering if it is possible to identify the index of a multidimensional array (0-5) given one of its elements (id in this case). I am trying to create next and previous links on a page. For example, if someone clicks on a project with the id of 18 (index [2]), would it be possible to refer back to the array and extract the id for the record before (23) and the next record (6) so I could create the appropriate next and previous links on a page?

Link to comment
https://forums.phpfreaks.com/topic/45086-help-with-multidimensional-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.