Return Functions/Methods in a class

Reply

Join Date: Sep 2005
Posts: 1,087
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Return Functions/Methods in a class

 
0
  #1
Jul 25th, 2006
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
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 19
Reputation: Rotak is an unknown quantity at this point 
Solved Threads: 0
Rotak Rotak is offline Offline
Newbie Poster

Re: Return Functions/Methods in a class

 
1
  #2
Jul 29th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,087
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: Return Functions/Methods in a class

 
0
  #3
Jul 29th, 2006
Thanks alot man!
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 3083 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC