why doesn't $this in PHP always refer to the current class?
<p>I'm a Java developer who has turned to the dark side over the last couple of weeks as I've been trying to write some code in PHP for the first time ever.</p>

<p>Most stuff seems familiar, methods become functions, . becomes ->, variables have a $ in front and you never have any idea what type they are, I get it, but I'm totally stumped by the $this keyword. </p>

<p>I expect $this to call a function in the current class as in java this.myCoolMethod(), but often as I poke through the open source project I'm going through, $this->myCoolMethod() calls a function in a totally different class!</p>

<p>What is happening here? What does '$this' actually mean?</p>

<p>Thank you for any help. </p>

<p>John</p>
