Beispiel #1
0
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new God();
     }
     return self::$instance;
 }
Beispiel #2
0
<?php

$god = God::getInstance();
//will not run the constructor because its alrady created
$god = God::getInstance();
Beispiel #3
0
 public function __construct()
 {
     if (!God::$instance) {
         God::$instance = $this;
     }
 }