Hi all,

I was wondering if there is a way of getting the list of functions inside a class in PHP4.

This would be similar to the ReflectionClass in php5.

Say for example I have:

class testclass {

	
	function func1() {
		echo 'I am func1';
	}
	
	function func2() {
		echo 'I am func2';
	}

}

$ana = new Analysis('testclass');
$ana->getFunctionsList(); // should return array( 'func1', 'func2' );

Is there such a function in php4? or if someone knows of a way to get that information?

I was thinking of serializing the class, and then using regex to get the functions out of the serialized string, but there should be an easier way?

Thanks in advance :)

Hi all,

I was wondering if there is a way of getting the list of functions inside a class in PHP4.

Try get_declared_classes() and get_class_methods(), and if needed get_defined_functions()...

With those, you can list all functions available within your actually running script.

Comments
Awesome! Just what i needed.
This article has been dead for over six months. Start a new discussion instead.