note 57768 added to function.get-class
| From: | davidc@php.net | Date: | Thu, 13 Oct 2005 17:25:19 +0000 |
| Subject: | note 57768 added to function.get-class | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-96970@lists.php.net to get a copy of this message | ||
As of php5, you cannot use get_class($this); in a public static function. You would have to do
something like this:
<?php
class BooBoof {
public static function getclass()
{
return __CLASS__;
}
}
$c = BooBoof::getclass();
print $c;
?>
To get the class since you cannot use
<?php
public static function getclass()
{
return get_class($this);
}
?>
Rather simple and straightforward but that might help some people that are searching for it..
----
Manual Page -- http://www.php.net/manual/en/function.get-class.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57768
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57768&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57768&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57768&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57768&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57768&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57768&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57768&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57768&report=yes
Search -- http://master.php.net/manage/user-notes.php