![]() |
Looping through an Object's members and changing its values
Say I have:
PHP Code:
2. Make the changed value permanent (i.e. I changed it by reference) In PHP you, it's basically this: PHP Code:
|
You can use the object's internal dictionary (assuming "obj" is an instance of some object):
Code:
for o in obj.__dict__:Code:
sauce = {"one": "some", "two": "value", "three": "here" }Code:
for key, value in obj.__dict__.items(): |
| All times are GMT +1. The time now is 12:53 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.