The get_class_methods() function gets the class methods' names. It returns an array of method names defined for the class specified by name_of_class. In case of an error, it returns NULL.
Syntax
get_class_methods(class)
Parameters
name_of_class − The class name. Required!
Return
The get_class_methods() function returns an array of method names defined for the class specified by name_of_class. In case of an error, it returns NULL.
Example
The following is an example −
<?php
class Demo {
function Demo() {
return(true);
}
function displayOne() {
return(true);
}
function displayTwo() {
return(true);
}
}
$method = get_class_methods('Demo');
$method = get_class_methods(new Demo());
foreach ($method as $method_name) {
echo "$method_name \n";
}
?>Output
Demo displayOne displayTwo