Jump to content

[SOLVED] Global?


DarkPrince2005

Recommended Posts

Ok, strangee and stupid question regarding global variables...

 

if i declare a the country of a user as a global variable when he logs in, will it be stored in the system memory or something for the duration of his session. And will it then be available even though he'll be navigating back and forth between different pages?

Link to comment
https://forums.phpfreaks.com/topic/168587-solved-global/
Share on other sites

No, making a variable a global variable only makes it availlable in the functions you're using it in your application, it won't make it availlable on other pages. Technically speaking it does save the variable somewhere in the memory because that's what happens when you declare a variable ... but not in the way you're asking for.

 

If you want to save some information from a user during his visit you can just save it in the session ... pretty logical ain't it ?  ;)

 

$_SESSION["country"] = "Belgium in my case ...";

 

I hope this gets you on your way ...

Link to comment
https://forums.phpfreaks.com/topic/168587-solved-global/#findComment-889256
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.