Is there a function to list all object's public methods and properties in PHP similar to Python's dir()?
Is there a function to list all object's public methods and properties in PHP similar to Python's dir()?
If you want to go deeper, and also get the private var of the object, you can use closure for that. like:
$sweetsThief = function ($obj) {
return get_object_vars($obj);
};
$sweetsThief = \Closure::bind($sweetsThief, null, $myobj);
var_dump($sweetsThief($myobj));