You are here: Re: I need $this->self to be identical to and reference to $this, but how in PHP 5.2+? « All PHP « IT news, forums, messages
Re: I need $this->self to be identical to and reference to $this, but how in PHP 5.2+?

Posted by comp.lang.php on 01/08/07 14:17

Hendri Kurniawan wrote:
> >
> >
> > Singleton... I like... :)
> >
> > <?php
> > function & generateSelf() {
> > static $self = null;
> > if(is_null($self)) $self = new EditResultGenerator();
> > return $self;
> > }
> > ?>
> >
> >
> > Hendri Kurniawan
>
>
> Sorry (forgot static keyword in front of function

Actually, I can't use the "static keyword" in front of the function.
Requirements are that it must be compatible all the way back to PHP
4.1.2, so that's out, sorry.

I'll give the rest a try, of course.

>
> <?php
> static function & generateSelf() {
> static $self = null;
> if(is_null($self)) $self = new EditResultGenerator();
> return $self;
> }
> ?>
>
> Hendri Kurniawan

 

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

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