note 108710 added to reflectionclass.hasmethod
| From: | michaelgranados at gmail dot com | Date: | Sat, 19 May 2012 14:47:41 +0000 |
| Subject: | note 108710 added to reflectionclass.hasmethod | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188073@lists.php.net to get a copy of this message | ||
A way to check if you can call an method over a class:
<?php
function is_public_method(
/* string */$className,
/* string */$method
){
$classInstance = new ReflectionClass($className);
if ($classInstance->hasMethod($method)) {
return false;
}
$methodInstance = $instance->getMethod($method);
return $methodInstance->isPublic();
}
?>
----
Server IP: 187.73.33.36
Probable Submitter: 187.38.225.197
----
Manual Page -- http://www.php.net/manual/en/reflectionclass.hasmethod.php
Edit -- https://master.php.net/note/edit/108710
Del: integrated -- https://master.php.net/note/delete/108710/integrated
Del: useless -- https://master.php.net/note/delete/108710/useless
Del: bad code -- https://master.php.net/note/delete/108710/bad+code
Del: spam -- https://master.php.net/note/delete/108710/spam
Del: non-english -- https://master.php.net/note/delete/108710/non-english
Del: in docs -- https://master.php.net/note/delete/108710/in+docs
Del: other reasons-- https://master.php.net/note/delete/108710
Reject -- https://master.php.net/note/reject/108710
Search -- https://master.php.net/manage/user-notes.php