Re: [RFC] Class instances counter
| From: | Lazare Inepologlou | Date: | Wed, 10 Apr 2013 10:31:46 +0000 |
| Subject: | Re: [RFC] Class instances counter | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-67023@lists.php.net to get a copy of this message | ||
2013/4/10 Frank Liepert <Frank.Liepert@gmx.de>
> Hello internals,
>
> again an update on the RFC, see
> https://wiki.php.net/rfc/instance_counter:
>
> - added support for object as argument
> - added support for array argument (indexed array with class names)
> - added more code examples
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
It is not entirely clear how the function treats subclasses. Does it count
only the *direct* instances of a class, or does it also count the instances
of subclasses?
class A {}
class B extends A {}
echo get_objects_count('A');
// 0
$a = new B;
echo $a instanceof A;
// 1 (true)
echo get_objects_count('A');
// ??? - 0 or 1 ?
Lazare Inepologlou
Ingénieur Logiciel