note 97788 deleted from function.method-exists by danbrown
| From: | danbrown@php.net | Date: | Sat, 08 May 2010 18:02:40 +0000 |
| Subject: | note 97788 deleted from function.method-exists by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-169075@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
If you want to check in a class itself if a method is known you may do so with magic variable
__CLASS__
<?php
class A{
__construct($method){
return method_exists(__CLASS__,$method);
}
private function foo(){
}
}
$test = new A('foo');
//should return true
?>
You might also use the method describe below with <?php in_array() ?> trick but I consider
this one here easier and more readable and well, the way it is intended toi be done ;)