Get all the defined functions for an object
10,464
Solution 1
Ah I found it:
Solution 2
You could use ReflectionClass
...
Author by
nickf
Javascript nerd. Senior Software Engineer at Google. Ex-SoundClouder.
Updated on June 09, 2022Comments
-
nickf almost 2 years
Is there an equivalent of
get_defined_functions()
which only shows the functions of a given object?Example usage and output:
class A { function foo() { } function bar() { } } class B extends A { function foobar() { } } $b = new B(); print_r(get_object_functions($b)); // Array ( // 0 => "foo", // 1 => "bar", // 2 => "foobar" //)
-
Vlad the Impala almost 9 yearsNOTE: this will get instance methods too, not just class methods. I got confused by this.