> From: Matt Babineau [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 22, 2002 3:59 PM > Subject: [PHP] What does register_globals do? > > I have never had a clear understanding about what this does, > the php.ini > has an explanation but being newer to PHP I don't understand it very > well. Could someone prodive a human explanation about what > register_globals does and why it is so important?
Register globals makes it *really* easy to code in php. It's what takes the uri or posted form data, and turns them into global variables in your script. So if a url looked like: http://www.fakename.com/index.php?target=help and with register-globals on, php will create a variable, $target, which has the value 'help' in it. It's very useful and friendly but, if you don't initialize your variables then some non-so-nice person could initialize them for you by passing them on the uri/post/cookie/etc so that your code no longer works as expected. You're safe with it on if you always initialize variables, and set error_reporting to E_ALL while testing so you catch any you might otherwise miss. If you leave it off, you need to use the associative arrays $_POST, $_GET etc. The above example would be $_GET['target']. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php