Jump to content

A few questions about GLOBALS


Goldeneye

Recommended Posts

Here a few questions I've had on my mind since I started using globalized variables in my script, so I figured that'd I'd ask them here.

 

1. How secure are globalized variables?

2. (Using the $GLOBALS[] array and the global construct) Is one method more secure than the other?

3. I read that PHP 6 is going have removed the register_globals option, does this mean the $GLOBALS[] array, and the global construct will become unusable?

Link to comment
https://forums.phpfreaks.com/topic/121648-a-few-questions-about-globals/
Share on other sites

Well I use them to reduce redundancy because I re-use certain variables quite often. So instead of redeclaring them, I simply globalized them using the global $var construct. That's really all I've used them for.

 

I read somewhere else that Globalized variable-names can be overlapped between different scripts. Like foobar.org/foo and foobar.org/bar both might have a globalized variable named $var (eventhough they are both using completely different scripts) which could cause potential problems. I don't know if that's correct, but that is what I understood from it.

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.