3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class a { var $text; function a() { $this->text = 'OK'; } } class b { var $text = 'NOT OK'; function b() { $this = new a(); } } $myClass = new b(); echo $myClass->text; ?>
Output for 5.1.3 - 5.4.34
Fatal error: Cannot re-assign $this in /in/NMYOR on line 11
Process exited with code 255.
Output for 5.0.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/NMYOR on line 4 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/NMYOR on line 10 Fatal error: Cannot re-assign $this in /in/NMYOR on line 11
Process exited with code 255.
Output for 4.3.0 - 4.4.9
OK