3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { function foo() { if (isset($this)) { echo '$this is defined ('; echo get_class($this); echo ")\n"; } else { echo "\$this is not defined.\n"; } } } // this will print '$this is defined (A)' $a = new A(); $a->foo(); // what does this print? A::foo();
Output for 7.0.0 - 7.1.0
$this is defined (A) Deprecated: Non-static method A::foo() should not be called statically in /in/VW0bc on line 21 $this is not defined.
Output for hhvm-3.10.0 - 3.12.0
$this is defined (A) $this is not defined.
Output for 5.0.0 - 5.6.28
$this is defined (A) Strict Standards: Non-static method A::foo() should not be called statically in /in/VW0bc on line 21 $this is not defined.
Output for 4.3.0 - 4.4.9
$this is defined (a) $this is not defined.