1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?php class Singleton { static public function getInstance() { return new self; } } class SuperSingleton extends Singleton { } $obj = SuperSingleton::getInstance(); var_dump($obj);
1 2
object(Singleton)#1 (0) { }