Copyright © tutorialspoint.com
| get_class_methods ( $class_name ); |
Gets the class methods names. Returns an array of method names defined for the class specified by class_name. In case of an error, it returns NULL.
| Parameter | Description |
|---|---|
| class_name | Required. The class name. |
Returns an array of method names defined for the class specified by class_name. In case of an error, it returns NULL.
Following is the usage of this function:
<?php
class myclass {
// constructor
function myclass()
{
return(true);
}
function myfunc1()
{
return(true);
}
function myfunc2()
{
return(true);
}
}
$class_methods = get_class_methods('myclass');
$class_methods = get_class_methods(new myclass());
foreach ($class_methods as $method_name) {
echo "$method_name<br>";
}
?>
|
It will produce following result:
myclass myfunc1 myfunc2 |
Copyright © tutorialspoint.com