You are here: Re: real world singleton class example? « PHP Programming Language « IT news, forums, messages
Re: real world singleton class example?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация