Re: how to count objects instances

From: Date: Tue, 24 Aug 2004 00:54:55 +0000
Subject: Re: how to count objects instances
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-194535@lists.php.net to get a copy of this message
tyler@carbon.homelinux.com wrote:
hi, What is best method(if it's possible) to count how many times an object is instanced in one time script call? I means that if i have a class named "Test", i what to know how many times she's called, how many copies exists etc. The idea is for monitoring in the way to optimizing the code. The method get_declared_classes() only shows only the classes included/required.
There's no predefined variable or method for determining this, that I'm aware of, short of counting how many "new Test" lines you have. You could write a wrapper class for Test that kept count of the instances and returned a new object upon request... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#194535) next »