Reputation: 3254
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?
Upvotes: 0
Views: 67
Reputation: 2545
You can try somethin like this:
$_SESSION['videoArray'] = $completeArray;
shuffle($_SESSION['videoArray']);
Upvotes: 0