lundi 10 août 2015

PHP Display random item from array

I have this array in PHP...

Array
(
    [0] => Array
        (
            [title] => Test Title 1
            [content] => Test Content 1
            [image_id] => 234
        )

    [1] => Array
        (
            [title] => Test Title 2
            [content] => Test Content 2
            [image_id] => 543
        )
)

I would like to echo the title, content and image_id randomly, I have had a look at the array_rand() function but it doesn't make sense to me in my situation.

Is this the best function to use?




Aucun commentaire:

Enregistrer un commentaire