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

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

It appears their variables are referrenced 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 setting that I can throw in PHP 5 that says to assume these are variables?


mysql_connect(DB_SERVER, DB_UserName, DB_Password);

in my day, that would be:

mysql_connect($DB_Server, etc, etc);

Their site has THOUSANDS of files... no I don't want to go put dollar signs in front of everything.




I believe OSCommerce actually DEFINES these values, so the usage is correct (without the $).

Look for

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

In other words, do not go through and update these with a $ before if they're actually defined constants.

You can use constants.

If i remember correctly a big difference is the lack of 'register_globals' being default to 'ON'. You might need to change a lot of instances here $var should be $_REQUEST['var'] or the appropriate $_GET/$_POST super globals.

And as far as constants are concerned you should access them as such:


This avoids PHP assuming that MY_CONSTANT is a string if the constant is not defined.

Need Your Help

RESTful services layer not being mapped by Jetty embedded

java servlets jersey jetty

I'm running a web application in an embedded instance of Jetty. The application has been implemented with Vaadin along with a layer of RESTful services. Everything seems fine except that the services

Cast listviewitem to System.IConvertible

c# winforms listview iconvertible

I have following issue... I got a listview in which I have some numbers (ID's). Now I want to arrange them with some listboxes so that I can do a typical SQL search (with OR, AND). So the listview ...