Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8667215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:54:46+00:00 2026-06-12T17:54:46+00:00

I have an array of elements in PHP called… $completeArray …and I’m trying to

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:54:47+00:00Added an answer on June 12, 2026 at 5:54 pm

    shuffle take a reference of an array and Returns TRUE on success or FALSE on failure.

    You should do:

    shuffle($completeArray);
    $_SESSION['videoArray'] = $completeArray;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not 100% but this ($settings) would be called an array in php: $setting;
In PHP I have an array containing 20 elements or more. The keys have
If I have this array: <?php $array[0]='foo'; $array[1]='bar'; $array[2]='foo2'; $array[3]='bar3'; ?> And I want
I have this code: $um = array(PHP, JAVA, MySQL) $a = count($um) for ($i
I have a php page that produces an array of elements. For the sake
I have an array that looks like this: PHP Syntax (Toggle Plain Text) array
I have this multidimensional array (called $values): Array ( [0] => Array ( [0]
I have an array of elements in Ruby [2,4,6,3,8] I need to remove elements
Consider I have an array of elements out of which I want to create
VISUAL C++ Question Hi, I have array of 3 elements and I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.