5
The function get_declared_classes
magpie ALL the classes defined in PHP, both from the internal PHP library and from the user.
I wanted a role for classes like: get_defined_functions
, that separates PHP core functions from user functions.
I think we can do with Reflection but I believe there is another option.
How to pick up classes defined by user in PHP?
There are some comments in the documentation that if you use the function before declaring the class, it will not appear in the list, so you could do a diff of the results, but I tested and appears even before declaring it...
– KaduAmaral
It would be better to log your Uploader.
– Papa Charlie
I tried a test here with
array_diff(get_declared_classes(), spl_classes())
, but some native classes were returned– Wallace Maxters
Taking all user classes is very common in frameworks, but they traverse the directories by opening and tokenizing the files to get the class names. If you are interested I can post a reply showing how to do
– Fábio Lemos Elizandro
Sometimes if you aim to get user-defined classes, more practical ways can arise to get what you need. What do you need it for?
– marcusagm
Need for debug questions... (information).
– Slowaways