note 106686 modified in function.get-class by danbrown
| From: | danbrown@php.net | Date: | Tue, 29 Nov 2011 15:43:55 +0000 |
| Subject: | note 106686 modified in function.get-class by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184788@lists.php.net to get a copy of this message | ||
Simplest way how to gets Class without namespace
<?php
namespace a\b\c\d\e\f;
class Foo {
public function __toString() {
$class = explode('\\', __CLASS__);
return end($class);
}
}
echo new Foo(); // prints Foo
?>
--was--
Simplest way how to gets Class without namespace
<?php
namespace a\b\c\d\e\f;
class Foo {
public function __toString() {
$class = explode('\\', __CLASS__);
return end($class);
}
}
echo new Foo(); // prints Foo
http://php.net/manual/en/function.get-class.php