Results for "Author: cakkie"
PHP offers a feature called Autoglobals and the importrequestvariables function. ASP doesn't. This article shows how we can do a simular thing, and address variables directly without having to do a lot of bulk and useless work.
A good thing to do is to never rely on autoglobals. They might just be turned off. For those not familiar with how autoglobals work, if you call a page say test.php?foo=bar, autoglobals allow you to access foo by using $foo, rather than using $_GET['foo']. However, if autoglobals are off, $foo will give a warning, and it's value will be empty rather than 'bar'. This little piece of code mimics autoglobals, thus preventing you from having to rewrite entire applications because they relied on autoglobals. Note that as of PHP 4.2, autoglobals are off by default.