Reply to Re: Static Attributes

Your name:

Reply:


Posted by Toby A Inkster on 07/13/07 12:09

MichaelD wrote:

> class testing implements Iterator
> {
> protected static $connection = false;
> ...
>
> public static function setConnection($connection)
> {
> if(!testing::connection)
> $this->connection = $connection;
> }
>
> public function __construct($query)
> {
> if(!testing::connection)
> echo 'Connection not set.';
> }
> ...
> }

class testing implements Iterator
{
protected static $connection = false;
...

public static function setConnection($connection)
{
if(!self::$connection)
self::$connection = $connection;
}

public function __construct($query)
{
if(!self::$connection)
echo 'Connection not set.';
}
...
}

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 22 days, 15:48.]

demiblog 0.2.0 Released
http://tobyinkster.co.uk/blog/2007/06/28/demiblog-0.2.0/

[Back to original 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

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