I am not unfamiliar with this
parameter in javascriptJavaScript. But in joomla'sJoomla's PHP files, I often come across $this
that seems coming from nowhere(Not in an object). To clarify some basic notions, here are some questions:
In JavascriptJavaScript, generally, if
this
is not inside an object, then it is referring to the global object, which inbrowserin a browser environment iswindow
. I understand that in PHP there is no such thing, but when it comes to what$this
is referring to, is there any similar thing?I think in most cases, for those
$this
not in an object, they actually reside in an object that is defined in another file, which 'require's current file, am I right? If yes, how can I find out where that file is, or what object$this
resides in? Althought usingUsing the extension "J!dump" I can actually see what$this
is, but I still want to know how to find out the parent object.