spondishy Posted September 2, 2009 Share Posted September 2, 2009 Hi, Just playing around with php at the moment and just wondered if there was a way of getting a list of all methods of an object that is being returned by an api I'm using. For example, the api returns an object of type x. What methods etc does x have. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/172836-get-properties-and-methods-from-an-object/ Share on other sites More sharing options...
trq Posted September 2, 2009 Share Posted September 2, 2009 Take a look at reflection. Quote Link to comment https://forums.phpfreaks.com/topic/172836-get-properties-and-methods-from-an-object/#findComment-910925 Share on other sites More sharing options...
JonnoTheDev Posted September 2, 2009 Share Posted September 2, 2009 Reflection class or simple method: $methods = get_class_methods(get_class($x)); print_r($methods); Quote Link to comment https://forums.phpfreaks.com/topic/172836-get-properties-and-methods-from-an-object/#findComment-911036 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.