How can I loop through all the properties of object?.I have to write a new code line to print each property of object
echo $obj->name;
echo $obj->age;
Can I loop through all the properties of an object using foreach loop or any loop?
Something like this
foreach ($obj as $property => $value)