php - How to output the methods from class -


<?php class     {         public $attribute1;         function operation1()             {                 echo 'operation1';             } } $a = new a(); var_dump($a); 

it shows:

object(a)[1]   public 'attribute1' => null 

question:

it outputs property in class a, if want see methods/functions in class a, how do?

you can gets class methods' names

$class_methods = get_class_methods('a'); // or $class_methods = get_class_methods(new a());  foreach ($class_methods $method_name) {     echo "$method_name\n"; } 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -