I have an array of elements in PHP called…
$completeArray
…and I’m trying to store a randomized version of this array in my session called…
$_SESSION['videoArray']
…so I’m trying something like this…
$_SESSION['videoArray'] = shuffle($completeArray);
…but when I try to echo the first element of this randomized array like this…
$videoid = $_SESSION['videoArray'];
echo $videoid[0];
…all it’s returning is the ‘key’ of the element. How do I randomize the array and be able to echo the actual elements of the new array?
shuffle take a reference of an array and Returns TRUE on success or FALSE on failure.
You should do: