destruct

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dhinge
Forum Newbie
Posts: 12
Joined: Mon Jan 08, 2007 1:56 pm

destruct

Post by dhinge »

I have a class that opens a connection to MySQL, but upon __destruct, the class doesn't close the connection. Isn't __destruct supposed to do things like this, and why wouldn't it?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: destruct

Post by AbraCadaver »

The connection closes at the end of the script anyway, so it's kind of redundant. __destruct() is mainly used to do some cleanup or something when an object is destroyed.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply