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 8365977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:47:41+00:00 2026-06-09T12:47:41+00:00

page1: session_start(); $_SESSION[‘allCaps’]=array(img01.png, img02.png…); // 20 images page2: shuffle($_SESSION[‘allCaps’]); $_SESSION[‘fiveCaps’] = array_slice($_SESSION[‘allCaps’], 0, 5);

  • 0

page1:

session_start();
$_SESSION['allCaps']=array("img01.png", "img02.png"...);  // 20 images

page2:

shuffle($_SESSION['allCaps']);
$_SESSION['fiveCaps'] = array_slice($_SESSION['allCaps'], 0, 5);
foreach ($_SESSION['fiveCaps'] as $key=>$val)
echo $key." ".$val;   // result - five img.names - remember this

page3:

session_start();
shuffle($_SESSION['fiveCaps']);
foreach ($_SESSION['fiveCaps'] as $key=>$val)
echo $key." ".$val;   // result - five img. names - remember this

I excpect the two results allways to be the same, of course except the ordering the elements (because of shuffle on page3).
But sometimes the results are the same, sometimes (after reloading page3) – are not
On page3 appear the elements which don’t exist on page2

  • 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-09T12:47:43+00:00Added an answer on June 9, 2026 at 12:47 pm

    Remove this line from page 3:

    session_start();
    

    Also, be aware sometimes sessions get lost, because the web server was restarted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get an array across the pages page1: session_start(); $input01 = array(img01.png,
Page1.php: <?php session_start(); if ($_POST['password'] == testpass) $_SESSION['authenticated'] = true; ?> Page2.php <?php session_start();
I have the following pages: page1.php <?php if (isset($_GET['link'])) { session_start(); $_session['myvariable'] = 'Hello
I have the following pages: page1.php, page2.php and page3.php. Code in each of them
I created the script. Source - Controller - public function action_index() { session_start(); $_SESSION['token']
Here is my PHP code: <?php session_start(); if ( !isset($_SESSION['index_visited']) ) { $_SESSION['page2_visited'] =
Here is my index.php <?php session_start(); if($_SESSION['authorizedreferral'] == false){ //login.php sets 'authorizedreferral' to false,
I have a very simple test page for PHP session. <?php session_start(); if (isset($_SESSIONS['views']))
session_start() should be the first line of web page. Dreamweaver's php templates should be
session_start(); //login page if(mysql_num_rows($result) != '0'){ // If match. session_register(username); // Craete session username.

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.