note 106524 added to function.get-class
| From: | gwartur at gmail dot com | Date: | Wed, 16 Nov 2011 13:05:12 +0000 |
| Subject: | note 106524 added to function.get-class | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184520@lists.php.net to get a copy of this message | ||
This is more faster method then write at this notes:
==> me at nwhiting dot com 06-Dec-2010 04:14
for get class name without namespace need use basename() function
example:
<?php
namespace mynamespace;
class foo
{
}
class bar extends foo
{
}
$obj = new bar();
$class_name = get_class($obj);
echo $class_name, '<br>';
echo basename($class_name);
?>
result:
mynamespace\bar
bar
link:
http://php.net/manual/en/function.basename.php
Thank you for your attention.
----
Server IP: 69.147.83.197
Probable Submitter: 188.134.79.140
----
Manual Page -- http://www.php.net/manual/en/function.get-class.php
Edit -- https://master.php.net/note/edit/106524
Del: integrated -- https://master.php.net/note/delete/106524/integrated
Del: useless -- https://master.php.net/note/delete/106524/useless
Del: bad code -- https://master.php.net/note/delete/106524/bad+code
Del: spam -- https://master.php.net/note/delete/106524/spam
Del: non-english -- https://master.php.net/note/delete/106524/non-english
Del: in docs -- https://master.php.net/note/delete/106524/in+docs
Del: other reasons-- https://master.php.net/note/delete/106524
Reject -- https://master.php.net/note/reject/106524
Search -- https://master.php.net/manage/user-notes.php