|
|
|
| <?php
// PHP4 < 4.1 Compatibility
if (!function_exists('version_compare')) {
function version_compare ($a, $b, $c) {
return (TRUE);
}
}
if (version_compare(phpversion(), "4.1.0", "<")) {
$_SERVER = $HTTP_SERVER_VARS;
$_REQUEST = array_merge ($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS);
$_GET = $HTTP_GET_VARS;
$_POST = $HTTP_POST_VARS;
$_COOKIE = $HTTP_COOKIE_VARS;
$_FILES = $HTTP_POST_FILES;
$_SESSION = $HTTP_SESSION_VARS;
$_ENV = $HTTP_ENV_VARS;
} // End PHP4 < 4.1 Compatibility
?> | | |
|
| Pageinfo: Array containing page URI, page query string (parameters), request method (GET or POST) and the complete URI Categories : Variables, PHP Options and Info, Arrays, URLs, PHP | | | clearing variables in php3 Categories : Variables, Arrays, PHP | | | Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET Categories : Algorithms, HTML and PHP, PHP, Variables | | | PhpView 0.1 - simple php viewer, using temporary files and frames.
Categories : PHP, PHP Options and Info, Debugging, HTML and PHP | | | Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
Categories : PHP, Directories, Variables, Arrays | | | translate.php - Assocciative array example, passing a reference to a function. Categories : PHP, Arrays, Languages, Variables | | | This functions compares the current PHP version with a
desired version. Because of the 3 tiered version system, a
direct compare of a string to phpversion() will not be
accurate. Categories : PHP Configuration, PHP, Variables | | | Simple PHP program which calls other PHP program you can pass the
variables to other PHP program : by Raju Categories : PHP, PHP Options and Info, Regexps, Program Execution | | | dl -- load a PHP extension at runtime Categories : PHP, PHP Functions, PHP Options and Info | | | A simple function to prevent undefined $_POST/$_GET/$_SESSION variable errors Categories : PHP, Variables, Errors and Logging | | | How to control the number of decimal places when outputting numbers. Categories : PHP, Strings, Variables | | | Functions to read a template file and fill in PHP variables. It will also fill in array variables, displaying parts of the template multiple times.
Categories : PHP, Variables, Filesystem | | | A quick way set data from a form to a function or other places where you can lose scope. Categories : PHP, HTML and PHP, Variables | | | Accessing GET and PUT variables with HTTP_GET_VARS on Win2K. Categories : PHP, Windows 2000, Variables | | | Newbie Notes #5 - To double quote, or single quote, that is the question Categories : PHP, Beginner Guides, Variables | |
| | | | Justin French wrote :973
You aren`t REALLY ensuring compatability of an entire script, just the $_SERVER (etc) arrays.
There is still one LARGE difference however. $_SERVER, $_POST, etc are all superglobal arrays, which means you don`t have to do things like:
function foo()
{
global $_SERVER;
}
In your example, the user would still have to have a global ... statement in any user functions they declared.
Your example solves a LOT of problems, but not all :)
| |
|
|
|