thangappan Posted January 31, 2009 Share Posted January 31, 2009 How can I destroy PHP object.I am using PHP 5 version. Link to comment https://forums.phpfreaks.com/topic/143225-destroying-php-object/ Share on other sites More sharing options...
Prismatic Posted January 31, 2009 Share Posted January 31, 2009 use unset() unset($object); Link to comment https://forums.phpfreaks.com/topic/143225-destroying-php-object/#findComment-751141 Share on other sites More sharing options...
thangappan Posted January 31, 2009 Author Share Posted January 31, 2009 I want to destroy an object with in a class. class Add{ var $name; function add_name($name){ $this->name =$name; } } $object = new Add(); echo $object->add_name('Testing'); echo Add::name; It prints Testing. For an example, I am creating more than object dynamically.I want to destroy when the use of object has been finished. For a single class we can use unset() function to destroy an object.For more than one class what is the correct way? Can any one explain? Link to comment https://forums.phpfreaks.com/topic/143225-destroying-php-object/#findComment-751206 Share on other sites More sharing options...
Prismatic Posted January 31, 2009 Share Posted January 31, 2009 I want to destroy an object with in a class. class Add{ var $name; function add_name($name){ $this->name =$name; } } $object = new Add(); echo $object->add_name('Testing'); echo Add::name; It prints Testing. For an example, I am creating more than object dynamically.I want to destroy when the use of object has been finished. For a single class we can use unset() function to destroy an object.For more than one class what is the correct way? Can any one explain? http://us.php.net/language.oop5.decon Read the section on Destructor's Link to comment https://forums.phpfreaks.com/topic/143225-destroying-php-object/#findComment-751209 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.