Jump to content

Going over object's members


SyLon

Recommended Posts

Hello everyone.

Is there a way to go over each member of a given object using a foreach loop for example??

Here is an theoretical example:

 

foreach( object_members($object) as $object_name->$value ) {

echo $object_name.": ".$value;

}

 

OR

 

foreach( objects_member_names($object) as $member_name ) {

echo $member_name.": ".$object->$member_name;

}

 

I hope you an help me  :)

Thanks, Leon.

Link to comment
https://forums.phpfreaks.com/topic/78423-going-over-objects-members/
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.