PHP list class methods

In this PHP tutorial we will learn how to list methods of the class. We will also create one example to list all the methods/functions of the given class in PHP.

 
 

Share on Google+Share on Google+

PHP list class methods

Ads

In this PHP tutorial we will learn how to list methods of the class. We will also create one example to list all the methods/functions of the given class in PHP.

  • Function get_class_methods gives the all methods names of the given class.
  • It takes input as class name and returns the array of the methods name


PHP LIst Class Methods Example

<?php

class myclass{
function
aa(){}
function
bb(){}
function
cc(){}
}

$ar1
=get_class_methods("myclass");
foreach
($ar1 as $a1)
{
echo
"<br> class--> ".$a1;
}
?>


Output

class--> aa
class--> bb
class--> cc

Advertisements

Posted on: November 2, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles