PHP Classes

File: singleton.test.php

Recommend this page to a friend!
  Classes of Andrei Alexandru  >  Simple Singleton and Multiton Class  >  singleton.test.php  >  Download  
File: singleton.test.php
Role: Example script
Content type: text/plain
Description: Usage ot the singleton Class
Class: Simple Singleton and Multiton Class
Create and manage one or more singleton objects
Author: By
Last change: More examples
Date: 11 years ago
Size: 303 bytes


Class file image Download
// Requiere singleton class
require_once 'Singleton.class.php';

$single = Singleton::GetInstance();

// Fatal error -> private constructor
$newInstance = new Singleton();

// Fatal error -> No clonning
$clone = clone $single;

// Fatal error -> No serialization

For more information send a message to info at phpclasses dot org.