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

  • Home
  • SEARCH
  • 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 650897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:06:10+00:00 2026-05-13T22:06:10+00:00

This may be a bit of daft question, but I don’t come from an

  • 0

This may be a bit of daft question, but I don’t come from an OOP background and although I’m reading and learning as I go I’m still struggling with a few concepts.

Right now I’m working with PHP 5.3 and desiging a fairly simple login using a few different object classes: User which defines the user. Session which starts and maintains session data and if someone is logged in, and Database which does the queries.

So when my script is run, my session object is instantiated, etc… here’s my problem though. When I move from one page to the next how is that object tracked? Or perhaps rather my question is how does PHP know the objects that relate to my login are mine and not someone else who logged into the site?

I know if I’m doing this in a non OOP way, I’d simply check the session cookie on each page and check my data that way, which is fine my brain can handle that. But, where and how is object data tracked.

EG:
On each page I want to check if someone is logged in I reference $session->is_logged_in() etc is_logged_in checks the a private variable name is true or false.
There’s no checking of cookies at this point which means this object still exists, and, as it keeps asking for a stored variable the instance must persist to be useful… but how does PHP, the server, whatever tie that instance of that object to that user? If all of these objects float around on the server till I destroy them won’t there be lots of memory used by objects?

As I said at the start it’s probably a really basic, fundatmental question but I’m yet to have my eureka moment with this, I might go back to simpler PHP.

  • 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-05-13T22:06:11+00:00Added an answer on May 13, 2026 at 10:06 pm

    Session data (that is all the data in $_SESSION) is by default serialized and stored to file between requests. The data gets unserialized automatically when session_start() is called.

    From the PHP manual on Session Handling (emphasis mine):

    The session support allows you to register arbitrary numbers of variables to be preserved across requests. When a visitor accesses your site, PHP will check automatically (if session.auto_start is set to 1) or on your request (explicitly through session_start() or implicitly through session_register()) whether a specific session id has been sent with the request. If this is the case, the prior saved environment is recreated.

    Nothing is persisted in memory between requests. PHP has a shared nothing architecture, meaning all objects are recreated on each request anew, unless you are using dedicated cache mechanisms.

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

Sidebar

Related Questions

This may be a bit of a newbie question, but I just don't know!
This may sound like a bit of a rhetorical question, but I ask it
This question may seem a little bit stackoverflow-implementation specific, but I have seen a
This question may seem a bit stupid, but i'm new to Joomla! And i
Okay this one may be a bit out from left field, but I'm going
Ok this question may sound a bit convoluted, or at least esoteric, but I'll
This may be a bit of an easy, headdesk sort of question, but my
Ok this may seem like a bit of a noob question but one many
This may be a silly question but should I use the 32 bit or
This may be a easy question to answer but I am a bit stumped

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.