frustrated Posted November 10, 2006 Share Posted November 10, 2006 Hi, I'm wondering if there is some sort of function that you can pass an object to and it will reset all the properties of that object back to the original defaults values?Does anyone know of anything? Link to comment https://forums.phpfreaks.com/topic/26788-easy-way-to-reset-properties-of-an-object/ Share on other sites More sharing options...
Zane Posted November 10, 2006 Share Posted November 10, 2006 just declare a new instance of that objecte.g[code=php:0]$foo = new Foo;$foo->name = "Bar";$foo->displayName();//prints Bar;$foo = new Foo$foo->displayName();//prints nothing at all[/code] Link to comment https://forums.phpfreaks.com/topic/26788-easy-way-to-reset-properties-of-an-object/#findComment-122498 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.