<?php class ME { public static function staticMethod() { echo 'Derp!'; } public function yarr() { $this::staticMethod(); } public function hurr() { self::staticMethod(); } public static function durr() { $this::staticMethod(); } } $x = new ME(); $x->yarr(); echo "\n"; $x->hurr(); echo "\n"; ME::durr();
Standard input is empty
Derp! Derp!
PHP Fatal error: Uncaught Error: Using $this when not in object context in /home/VboCmE/prog.php:17 Stack trace: #0 /home/VboCmE/prog.php(33): ME::durr() #1 {main} thrown in /home/VboCmE/prog.php on line 17
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!