Reputation: 10981
Is there a way to know the type (sorry if this is not the correct name) of a method inside a object? Imagine you have an object with 5 methods, 3 of them being public and the remaining protected / private, how can you know if a method is public?
Cheers!
Upvotes: 1
Views: 404
Reputation: 7504
You can use reflection for getting info about classes and objects. Look at http://www.php.net/manual/en/book.reflection.php
$reflection = new ReflectionClass('TestClass');
$aMethods = $reflection->getMethods();
var_dump($aMethods[0]->isPublic());
Upvotes: 5