Jump to content

Get Properties in a class


The Little Guy

Recommended Posts

I am trying to read the properties of a class, but I keep getting an empty array..

 

print_r(get_object_vars(new MyClass()));

 

In my class all the vars are set to protected, but I would like to get them. If I change them to public then it reads them fine. How can I get all the properties in a class?

Link to comment
https://forums.phpfreaks.com/topic/187810-get-properties-in-a-class/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.