Suppose there is a input file. The file contains php class with many functions and public variable.
I need a php script that would take that input file and count how many php function are there. This script will also print the function name like ..
public function hasMethod($method)
public function isVirtualField($field)
Can anyone post such php script to do this ?
get_class_methods()
will give you all methods in a given object or class name, see PHP func ref
require_once('Model.php');
$methods = get_class_methods('Model');
print_r($methods);
Will show you all methods of the class Model
in file Model.php
class theclass {
// constructor
function theclass() {
return;
}
function func1() {
return;
}
// method 2
function func2() {
return;
}
}
$class_methods = get_class_methods('theclass');
foreach ($classFunctions as $functionName) {
echo "$functionName
";
}