progwihz@yahoo.com Posted November 30, 2007 Share Posted November 30, 2007 Hi all, am running a code created with php4 on a php5 engine and I am running into problems with the $this . In php4 its a variable and in php5 its a ref to a class object (if am right) I get the following error in a class "Fatal error: Cannot re-assign $this in {path}" which is caused by this line "$this = new $db( $serv, $user, $pass, $dbName );" How can i resolve this ? am thinking of renaming $this to something like $this_var but then this is likely not to work. Cheers olu. Quote Link to comment Share on other sites More sharing options...
Wes1890 Posted November 30, 2007 Share Posted November 30, 2007 Try $this = new db( $serv, $user, $pass, $dbName ); Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 30, 2007 Share Posted November 30, 2007 The variable $this is registered variable, You cannot create a variable called $this as it is used by PHP. You'll have to change your variable to something else, say $_this or $This Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.