Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50411 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51403 invoked from network); 22 Nov 2010 12:52:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Nov 2010 12:52:44 -0000 Authentication-Results: pb1.pair.com header.from=php@stefan-marr.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@stefan-marr.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain stefan-marr.de from 85.88.12.247 cause and error) X-PHP-List-Original-Sender: php@stefan-marr.de X-Host-Fingerprint: 85.88.12.247 toolslave.net Received: from [85.88.12.247] ([85.88.12.247:55437] helo=uhweb12247.united-hoster.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/E1-13423-9976AEC4 for ; Mon, 22 Nov 2010 07:52:42 -0500 Received: from [134.184.43.20] by uhweb12247.united-hoster.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1PKVso-0001zl-N4; Mon, 22 Nov 2010 13:52:37 +0100 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Mon, 22 Nov 2010 13:52:36 +0100 Cc: Sebastian Bergmann , internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <706B10FD-FA57-491D-B30B-E8503795F981@stefan-marr.de> References: <4CEA596A.7010700@php.net> To: Simas Toleikis X-Mailer: Apple Mail (2.1081) Subject: Re: [PHP-DEV] Traits and static methods From: php@stefan-marr.de (Stefan Marr) Hi Simas: On 22 Nov 2010, at 13:47, Simas Toleikis wrote: > Would it work if instance is saved inside a local static var like: >=20 > public static function getInstance() { >=20 > static $instance =3D NULL; >=20 > if (is_null($instance)) { > $instance =3D new self(); > } >=20 > return $instance; > } = http://svn.php.net/viewvc/php/php-src/trunk/Zend/tests/traits/language013.= phpt?revision=3D300283&view=3Dmarkup The test case says it works ;) Best regards Stefan --=20 Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525