Just a quick question....
Hi, for those of you that have checked my introduction post, you will know that I am an Art Director that just knows a bit of programming...
While I might know some I do not speak the programmers terms/language...is there a good reference that anyone can point me to where I can get terms in regular English...
I know when I might need to do something like
NM I found the glossary…this may answer a lot of my questions…
"$this" is a pseudo variable used within a class to refer to the class itself. Obviously, since the object hasn't been instantiated yet, we can't use it within the class.
say I have an object $foo
and a property $bar, I can now call that property
BUT, within the class code, I don't know I'm going to call the object "$foo", so "$this" is used as a generic reference to the object
I'm just getting my head round classes myself, so I hope that helps :-)
Thanks for the reply...$this was not in the Glossary.
So it makes better sense now.
Like I said, I know when, but not the whys or what fors of most of this...haha
So now how do I close this Thread?
It might also be worth to notice that $this is a reserved keyword and cannot be overridden when called inside a method.
$this is only available when a method is called from an intialized object, and not staticlly calls, eg. this wouldn't work:
Yes it does! Thank you!
|All times are GMT. The time now is 01:37 PM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0