コード例 #1
0
ファイル: singleton.php プロジェクト: roroxide/designpattern
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new SingletonType();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: test.php プロジェクト: roroxide/designpattern
<?php

include __DIR__ . "/singleton.php";
$o = SingletonType::getInstance();
$o->doSomething();