PDA

View Full Version : PHP version incompatibility


codefox
01-02-2003, 05:40 PM
I learnt a bit of PHP sometime back. The version I learnt was 4.0.6. I ported my site to a new server running PHP 4.2.3 and now I get some errors and warnings. Though I managed to get rid of them, I'm now confused as to how to make my PHP pages portable among servers running different versions. For example, all my global variables which I used to declare as global previously, could now be used as $GLOBAL['var_name']. Similarly, the $PHP_SELF variable has now become $_SERVER['PHP_SELF']. I changed all the pages to conform to the newer version and when I tried running these pages from a server running an older version of PHP many of the variables didn't work. Could anyone give me details about the imcompatibilities among the versions?

Thanks.

bcarl314
01-02-2003, 06:09 PM
I believe these should work on php 4.0.x and later...

$HTTP_POST_VARS['myVar'];
$HTTP_GET_VARS['myVar'];
$HTTP_SERVER_VARS['myVar'];

in php 4.1 and later you can shorthand these as
$_POST['myVar'];
$_GET['myVar'];
$_SERVER['myVar'];

and if you turn register_globals to "on" in the php.ini file, you can use $myVar for all of them in php4.2 and later.