3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { function __construct($q) { $this->q = $q; } static function b() { echo $this->q; } } $a = new a(1); $a->b();
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Creation of dynamic property a::$q is deprecated in /in/EfuKk on line 5 Fatal error: Uncaught Error: Using $this when not in object context in /in/EfuKk:9 Stack trace: #0 /in/EfuKk(13): a::b() #1 {main} thrown in /in/EfuKk on line 9
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Fatal error: Uncaught Error: Using $this when not in object context in /in/EfuKk:9 Stack trace: #0 /in/EfuKk(13): a::b() #1 {main} thrown in /in/EfuKk on line 9
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Fatal error: Using $this when not in object context in /in/EfuKk on line 9
Process exited with code 255.

preferences:
285.17 ms | 402 KiB | 339 Q