Please note that I have read similar questions on this site but none worked for me and this seem unique at least for now/to me.
I have the following array;
[{"advert_id":"advert1"},{"advert_id":"advert2"},{"advert_id":"advert3"},{"advert_id":"advert4"},{"advert_id":"advert5"},{"advert_id":"advert6"},{"advert_id":"advert7"}]
I actually got the data when I fetch information from database with Laravel $adverts = Advert::select('advert_id')->get();
How can I randomly select an element from it?
I tried using array_rand($adverts)
but had errors (array_rand() expects parameter 1 to be array, object given )