Posted by B.r.K.o.N.j.A on 12/01/06 14:29
d.adamkiewicz@i7.com.pl wrote:
> Hello Folks
>
> Anybody can show me real world singleton class example?
> Something that works (is implemented) as part of working solution.
> Does it make sense to create database handler class that way?
>
> Regards
> Darek
>
If you're using php5 then any example from web will work, here's one of
my own :) (I use it in real world applications)
<?php
class mysingleton
{
private static $instance;
private function __construct()
{
}
public static function instance(){
if(!self::$instance){
self::$instance=new self();
}
return(self::$instance);
}
}
?>
--
B.r.K.o.N.j.A = Bionic Robotic Knight Optimized for Nocturnal Judo and
Assasination
Navigation:
[Reply to this message]
|