3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { function a () { $this = 5; var_dump('reassigned', $this); } } $a = new A(); var_dump('new', $a); $a->a(); var_dump('modified', $a);
based on bsPou
Output for 5.0.0 - 5.4.35
Fatal error: Cannot re-assign $this in /in/6gKQH on line 7
Process exited with code 255.
Output for 4.3.2 - 4.4.9
string(10) "reassigned" int(5) string(3) "new" int(5) Fatal error: Call to a member function on a non-object in /in/6gKQH on line 16
Process exited with code 255.
Output for 4.3.0 - 4.3.1
string(10) "reassigned" int(5) string(3) "new" int(5) Fatal error: Call to a member function on a non-object in /in/6gKQH on line 16