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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:36:47+00:00 2026-06-13T03:36:47+00:00

Is it good practice to try to save a generic array in the $_SESSION

  • 0

Is it good practice to try to save a “generic” array in the $_SESSION array for the purpose of applyng e.g PHP sorting functions instead of calling a new result set from the server? Seems abit overkill to e.g call a new result set if I want to sort comments based on likes instead of timestamp. Maybe there is another best practice for this “problem”? How much efficiency is there to be gained working like this? Is it very much?

  • 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-13T03:36:49+00:00Added an answer on June 13, 2026 at 3:36 am

    That may be a very good option, or a disastrous one.

    You have the advantages clear, or it seems that way, but the drawbacks are immense depending on the number of users, the frequency of changes of those results, the size of the array etc.

    If you plan on keeping it as a global variable during the life of the script, it’s not bad.

    If you have very few users, then it may be ok, but consider the size.

    If the results are going to change often, then you have double work since you have to keep checking that the values in the session are still fresh and right to use.

    With out the complete set of data about users, frequency of use, etc, I’ll say that you should not use that option.

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

Sidebar

Related Questions

I usually made php forms and try to use good practices in them. I'm
Is this considered good programming practice in C++: try { // some code }
I am wondering is it good practice to try to make a view that
Is this good practice to wrap every function with try and catch? I'm building
Which one is a good combination with UI layers try-catch and a good practice
I was wondering, is it good practice to return from try block? package debug;
Is it good practice to have more than one try{} catch{} statement per method?
I am looking for good practice or pattern to write a lib in JS.
Is it a good practice to have multiple XXX : DbContext classes for each
Is it good practice to use custom error levels on trigger_error() ? For example,

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.