3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class trial{ public $id; public static $sid; public static function show(){ if (trial::$sid) echo trial::$sid; else echo $this->id; } } $obj = new trial(); $obj->id = 1; $obj->show(); echo "\n\n"; trial::$sid = 5; echo trial::show();
based on SS9K5
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/VoCQY:9 Stack trace: #0 /in/VoCQY(15): trial::show() #1 {main} thrown in /in/VoCQY on line 9
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Fatal error: Using $this when not in object context in /in/VoCQY on line 9
Process exited with code 255.