Curt Zirzow wrote:

* Thus wrote Robert Cummings:

On Mon, 2004-08-23 at 20:54, John Holmes wrote:

[EMAIL PROTECTED] wrote:

You could write a wrapper class for Test that kept count of the instances and returned a new object upon request...

In PHP5:

<?php

class Foo
{
   static $instances = 0;

function __construct()
{
Foo::$instances++; }


   function __destruct()
   {
       Foo::$instances--;
   }


And:
function __clone() {
Foo::$instances++;
}



Curt
Ooops, didn't see your post, hehe...

By the way, use "self" instead of "Foo", just in case you change the class' name.

--
Daniel Schierbeck

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to