Obtenga el modificador de acceso / visibilidad de cada método

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?


preguntado el 27 de agosto de 11 a las 21:08

"El visibilidad of a property or method can be defined by prefixing the declaration with the keywords público, protegido or privada"-

1 Respuestas

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(); 

Respondido 28 ago 11, 01:08

Thank you, that's what I needed :) - yoda

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.