Jump to content
Sign in to follow this  
iwato

PHP - Passing Variables with Superglobals

Recommended Posts

QUESTION:  When a variable is passed via a super global from one file to another what happens to the variable that is passed?

  • Where is it stored?
  • What is its half-life?

Roddy

Share this post


Link to post
Share on other sites

A super global is available during the execution of the process. What do you mean by passing it to another file?

If the file is included, it has access to all the superglobals of the file that included it.

Share this post


Link to post
Share on other sites

Hi Ingolme, I was not clear.  I want to know where the superglobal is stored?  And, for how long I can use it and its contents after it has been sent.

Based upon your response I should probably ask, if there is a way to pass a superglobal in such a way that it is permanently stored, and then accessible from any file with a get_file_contents( ) method.

Roddy

Share this post


Link to post
Share on other sites

The superglobal is like any other variable in the PHP process, it only exists during the time the script is running. If you want to store its value permanently somewhere you can use a database or write it to a file.

If you want to store something for one user during a browsing session you can use PHP sessions.

  • Like 1

Share this post


Link to post
Share on other sites
Quote

If you want to store something for one user during a browsing session you can use PHP sessions.

I am not there yet.

Quote

If you want to store its value permanently somewhere you can use a database or write it to a file.

OK.  This is what I needed to know.  As ever, thank you, for your wonderful help.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...