05-31-2011, 05:22 PM
Hi, i ran accross some code that used "this" in several places but i am unable to find where "this" is set. I did some googling and was unable to find some resources because i am not aware what keyword to search for.
What is "this" ?
Is it a php function?
Just a standard variable that people use?
i dont know what it is and if it already has value or if i need to give it value.
link to some documentation or any help appreciated, thanks so much.
can you post the code or a portion of it, say, from the top down to where 'this' is showing.
05-31-2011, 05:32 PM
here is one, but it appears in others as well, the other one looks like some kind of class statment but i cant be sure.
but here is this one(it pulls up an image on mouseover)
but i cant find where this is set because im not sure what im looking for.
05-31-2011, 05:33 PM
$this is reserved and cannot be assigned to.
Its a scope resolution for objects. $this resolves to this instance of a class, and PHP doesn't allow variable masking so $this->member and $this->method() must always be used. It is only usable within the scope of an object.
I can't recall which version actually forced this, but I think somewhere between the 5.0 and 5.1 time $this was actually assignable. This was later changed to throw a fatal error. At least I think it was PHP that had done that.
05-31-2011, 06:13 PM
I think somewhere between the 5.0 and 5.1 time $this was actually assignable. This was later changed to throw a fatal error. At least I think it was PHP that had done that.
Yeah, it was right as/after 5.0 came out. Something like 6 years ago.
06-01-2011, 06:25 AM
thanks Fou-Lu sorry so late getting back to you, my third party mail client crapped out of me (MS changed its protocal for ssl) and i was upside down getting and sending emails to customers. what a day...
I really appreciate the info. peace dave