I have an array of objects in PHP. I need to pick 8 of them at random. My initial thought was to use array_rand(array_flip($my_array), 8) , but this does not work because objects cannot act as keys for an array.
I know I can use shuffle , but I'm concerned about performance, as the array grows in size. Is this a better way, or is there a better way?
source share