note 95829 modified in reflectionclass.construct by danbrown
| From: | danbrown@php.net | Date: | Wed, 18 Aug 2010 15:51:15 +0000 |
| Subject: | note 95829 modified in reflectionclass.construct by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171810@lists.php.net to get a copy of this message | ||
It's very useful to know that you can also use the ReflectionClass to inspect interfaces, even
thouth Interfaces are not classes. Example:
<?php
interface Edible
{
public function eat();
}
$refl = new ReflectionClass("Edible");
$methods = $refl->getMethods();
?>
[Edit by danbrown AT php DOT net - Contains a bugfix by (dbl AT bnet DOT com) on 18-AUG-2010 with
the following message: "underline had to be removed for it to work ( new Reflection_Class ->
new ReflectionClass )"]
--was--
It's very useful to know that you can also use the ReflectionClass to inspect interfaces, even
thouth Interfaces are not classes. Example:
<?php
interface Edible
{
public function eat();
}
$refl = new Reflection_Class("Edible");
$methods = $refl->getMethods();
?>
http://php.net/manual/en/reflectionclass.construct.php