<?php
class Shop {
private static $instance;
public $name="shop";
private function ___construct() {
}
public static function getInstance() {
if ( empty( self::$instance ) ) {
self::$instance = new Shop();
}
return self::$instance;
}
}
$first = Shop::getInstance();
$first-> name="A";
$second = Shop::getInstance();
print $second -> name;
?>
|