Exemplo n.º 1
0
 public function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Exemplo n.º 2
0
 public function getInstance()
 {
     if (!self::$instance) {
         // 例題ではsynchronizedを使用している。
         // PHPではマルチスレッドがどういう挙動になるのかわからない。
         self::$instance = new self();
     }
     return self::$instance;
 }