note 97323 added to function.is-resource

From: Date: Wed, 14 Apr 2010 16:20:36 +0000
Subject: note 97323 added to function.is-resource
Groups: php.notes 
Request: Send a blank email to php-notes+get-168233@lists.php.net to get a copy of this message
A better example would be: <?php class Example { protected $db; function __construct() { $this->db = mysql_connect('host', 'user', 'pass') or die(mysql_error()); } function __destruct() { if (is_resource($this->db)) { mysql_close($this->db); } } } ?> Use this avoid using error supression on mysql_close() (@mysql_close()) seeing as mysql_close() throws an E_WARNING when trying to close a resource link that has already been closed. ---- Server IP: 92.48.119.85 Probable Submitter: 69.90.176.226 ---- Manual Page -- http://www.php.net/manual/en/function.is-resource.php Edit -- https://master.php.net/note/edit/97323 Del: integrated -- https://master.php.net/note/delete/97323/integrated Del: useless -- https://master.php.net/note/delete/97323/useless Del: bad code -- https://master.php.net/note/delete/97323/bad+code Del: spam -- https://master.php.net/note/delete/97323/spam Del: non-english -- https://master.php.net/note/delete/97323/non-english Del: in docs -- https://master.php.net/note/delete/97323/in+docs Del: other reasons-- https://master.php.net/note/delete/97323 Reject -- https://master.php.net/note/reject/97323 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168233) next »