Re: Traits and static methods
| From: | Stefan Marr | Date: | Mon, 22 Nov 2010 12:52:36 +0000 |
| Subject: | Re: Traits and static methods | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50411@lists.php.net to get a copy of this message | ||
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:
>
> public static function getInstance() {
>
> static $instance = NULL;
>
> if (is_null($instance)) {
> $instance = new self();
> }
>
> return $instance;
> }
http://svn.php.net/viewvc/php/php-src/trunk/Zend/tests/traits/language013.phpt?revision=300283&view=markup
The test case says it works ;)
Best regards
Stefan
--
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