FAQ
if a class need that, it can implement a interface like instance_counter,
which will simply can implement like:

class A {
public static $instance_counter = 0;

public function __construct() { self::$instance_counter++; }

public function __destruct() { self::$instance_counter--; };

public static function get_counter() { return self::$instance_counter; }
}

thanks

On Tue, Apr 9, 2013 at 6:18 PM, Frank Liepert wrote:

Hello internals,

I updated the RFC (https://wiki.php.net/rfc/instance_counter):

- added support for a class name, so the function can be narrowed down to a
specific class
- added use case


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

--
Laruence Xinchen Hui
http://www.laruence.com/

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 8 | next ›
Discussion Overview
groupphp-internals @
categoriesphp
postedApr 8, '13 at 7:47p
activeApr 9, '13 at 10:30a
posts8
users6
websitephp.net

People

Translate

site design / logo © 2022 Grokbase