3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class ABase { const I_AM_CONSTANT = 'shazam'; private static $instance = null; public function getInstance() { if(self::$instance == null) { self::$instance = new ABase(); } } private function __construct() { } } class B extends ABase { const I_AM_CONSTANT = 'kaboom!'; private static $instance = null; private function __construct() { } } $bInstance = B::getInstance(); echo B::I_AM_CONSTANT;
based on bIQlK
Output for 7.0.0 - 7.2.0
Deprecated: Non-static method ABase::getInstance() should not be called statically in /in/hI980 on line 28 kaboom!
Output for 5.3.21 - 5.6.21
Strict Standards: Non-static method ABase::getInstance() should not be called statically in /in/hI980 on line 28 kaboom!