How to randomly choose items from an array ?

php, random

Solution

Put the items in an array and use:

$selectrand = array_rand($arrayname, 5);

Problem

I have an array of 50 items and I would like to choose 5 of them randomly and get an array back. Is there a function for this?

Original source