As per PHP documentation about Variable variables:

$this is a special variable that cannot be referenced dynamically

However it seems that it's false, at least on the version of PHP, I've tested (5.5.12).

class ThisIsBugged { public function __construct() { ${'this'}->doSomething(); // This works, while it shouldn't } }

Question #1: How can it work? According to the documentation it should not.

But there's more.

class ThisIsBugged { public function __construct() { // This does not work, but it could. See below. ${'th' . 'is'}->doSomething(); } }

It stops the execution as expected:

PHP Notice: Undefined variable: this PHP Fatal error: Call to a member function doSomething() on a non-object.

Note that the statement {'th' . 'is'} has been evaluated: "Undefined variable: this".

However (this is the strangest thing), referencing explicitly the special variable $this , fixes all the dynamic references used before or after that within the method.

class ThisIsBugged { public function __construct() { // Now it works while it shouldn't ${'th' . 'is'}->doSomething(); // This fixes both the previous and the subsequent calls $unused = $this; // Now it works while it shouldn't ${'th' . 'is'}->doSomething(); } }