3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a{ public function __construct(){ echo 'sub_class'; } } class b{ public function __construct(){ $this = new a(); } } $v = new b(); echo get_class($v);
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.17
Fatal error: Cannot re-assign $this in /in/uWH5q on line 9
Process exited with code 255.

preferences:
176.07 ms | 1387 KiB | 53 Q