PHP 3 to PHP 5 Upgrade ... Variables in 3 didn't have $ in front ... is there a setting for backward compatibility?

OK, this is an odd request, and it might not even be quite right ... but I'm upgrading someone's system ... and they are using OSCommerce (a long, long time ago).

It looks like their variables are bound without a dollar sign in front of them (which is new to me). I haven't done PHP in about 7 years and I've always used dollar signs.

Is there a parameter I can use for PHP 5 that says they are variables?

Example:

mysql_connect(DB_SERVER, DB_UserName, DB_Password);

      

on my day, it would be:

mysql_connect($DB_Server, etc, etc);

      

Their site has THOUSANDS of files ... no. I don't want all dollars to display dollar signs.

HELP!

Thank,

0


source to share


3 answers


I believe that OSCommerce WILL actually DETERMINE these values, so the usage is correct (no $).

Find



define ("DB_SERVER", "localhost");
or something similar.

In other words, don't go over and update them with $ before if they are indeed defined by constants.

+7


source


You can use constants .



0


source


If I remember correctly, the big difference is that there is no "register_globals" by default 'ON'. You may need to change many instances here $ var should be $ _REQUEST ['var'] or matching super eyes $ _GET / $ _ POST.

And as far as constants are concerned, you should refer to them as such:

constant('MY_CONSTANT')

      

This avoids PHP's assumption that MY_CONSTANT is a string if no constant is defined.

0


source







All Articles