Best way to get the current Class Name or Function w/ proper case?
| From: | Garth Dahlstrom | Date: | Sat, 06 Oct 2001 04:53:43 +0000 |
| Subject: | Best way to get the current Class Name or Function w/ proper case? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70194@lists.php.net to get a copy of this message | ||
Currently, I have code similiar to the following:
class PHPWidgets {
function PHPWidgets()
{
...
// Define/redefine class extends 'layout'
if (!is_array($classname))
{
$this->classname = array($this->classname);
}
$this->classname[]='PHPWidgets';
...
}
}
In the hopes of further abstracting things a bit more,
I was wondering if it would be possible to code something
similar to the following:
class PHPWidgets {
function PHPWidgets()
{
...
// Define/redefine class extends 'layout'
if (!is_array($classname))
{
$this->classname = array($this->classname);
}
$this->classname[]=get_class($this);
... ^^^^^^^^^^^^^^^^
}
}
Howerver, I see in the manual that get_class returns
the class name in lower case... 'phpwidgets'...
has anyone got a work around for this?
Perhaps calling a 'get_function_name' function on the
current function (since the Constructor has the same
name as the class) or a overridden implementation of
get_class that will respect the casing?
-GED
Northern.CA ===--
http://www.northern.ca
Canada's Search Engine