getting name of class from a parent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I need a way to create an instance of a class, from a parent of that class.

Lets say I have the following code:

<?php

class base_class{
   static function get_instance(){
        // code I need goes here
    }
}

class utility_class {
}

$instance = utility_class::get_instance()

?>

You may be wondering why I don't just " $instance = new utility_class 
" - the reason is that I want to only create one of these instances. I
don't want any more than one instance of utility_class at any one
time.

I can't use get_class($this) either, because, there is no $this when
I'm accessing the method staticly.

Any suggestions?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux