PHP list class methods


 

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.

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

Ads