3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function a () { $this = rand(); var_dump('reassigned', $this); } } $a = new A(); var_dump('new', $a); $a->a(); var_dump('modified', $a); var_Dump(new A(), new A(), new A(), new A());
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.35
Fatal error: Cannot re-assign $this in /in/GrWX1 on line 7
Process exited with code 255.
Output for 4.4.9
string(10) "reassigned" int(1811988218) string(3) "new" int(1811988218) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.4.8
string(10) "reassigned" int(361970320) string(3) "new" int(361970320) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.4.7
string(10) "reassigned" int(1318630882) string(3) "new" int(1318630882) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.4.6
string(10) "reassigned" int(231905421) string(3) "new" int(231905421) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.4.5
string(10) "reassigned" int(1915790150) string(3) "new" int(1915790150) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.4.4
string(10) "reassigned" int(533100351) string(3) "new" int(533100351) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.4.3
string(10) "reassigned" int(239549456) string(3) "new" int(239549456) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.4.2
string(10) "reassigned" int(1855584564) string(3) "new" int(1855584564) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.4.1
string(10) "reassigned" int(964991561) string(3) "new" int(964991561) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.4.0
string(10) "reassigned" int(889526307) string(3) "new" int(889526307) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.3.11
string(10) "reassigned" int(2139511032) string(3) "new" int(2139511032) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.3.10
string(10) "reassigned" int(1294773779) string(3) "new" int(1294773779) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.3.9
string(10) "reassigned" int(1856582442) string(3) "new" int(1856582442) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.3.8
string(10) "reassigned" int(559180063) string(3) "new" int(559180063) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.3.7
string(10) "reassigned" int(1674365713) string(3) "new" int(1674365713) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.3.6
string(10) "reassigned" int(433592114) string(3) "new" int(433592114) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.3.5
string(10) "reassigned" int(1314605919) string(3) "new" int(1314605919) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.3.4
string(10) "reassigned" int(1139902448) string(3) "new" int(1139902448) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.3.3
string(10) "reassigned" int(830241369) string(3) "new" int(830241369) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.3.2
string(10) "reassigned" int(1866652346) string(3) "new" int(1866652346) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Process exited with code 255.
Output for 4.3.1
string(10) "reassigned" int(543884680) string(3) "new" int(543884680) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16
Output for 4.3.0
string(10) "reassigned" int(512379450) string(3) "new" int(512379450) Fatal error: Call to a member function on a non-object in /in/GrWX1 on line 16

preferences:
217.14 ms | 1395 KiB | 125 Q