Voting

Please answer this simple SPAM challenge: eight minus one?
(Example: nine)

The Note You're Voting On

corpus-deus at softhome dot net
6 years ago
With regards to Singleton patterns (and variable class names) - try:

<?php
class MyClass {

 
// singleton instance
 
private static $instance;

 
// private constructor function
  // to prevent external instantiation
 
private __construct() { }

 
// getInstance method
 
public static function getInstance() {

    if(!
self::$instance) {
     
self::$instance = new self();
    }

    return
self::$instance;

  }

 
//...

}
?>

<< Back to user notes page

To Top