How can I loop through all the properties of object?. Right now 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)
If this is just for debugging output, you can use the following to see all the types and values as well.
If you want more control over the output you can use this: