943,987 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 5271
  • PHP RSS
Jul 25th, 2006
0

Return Functions/Methods in a class

Expand Post »
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:

[PHP]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' );[/PHP]

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
Similar Threads
Moderator
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
digital-ether is offline Offline
1,250 posts
since Sep 2005
Jul 29th, 2006
1

Re: Return Functions/Methods in a class

Quote originally posted by digital-ether ...
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.
Reputation Points: 11
Solved Threads: 0
Newbie Poster
Rotak is offline Offline
19 posts
since May 2005
Jul 29th, 2006
0

Re: Return Functions/Methods in a class

Thanks alot man!
Moderator
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
digital-ether is offline Offline
1,250 posts
since Sep 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: php/mysql communication problem
Next Thread in PHP Forum Timeline: listbox--issue php





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC