php - How to check if the mysqli_object has been freed? -
i need check if mysqli_result has been freed.
with ext/mysql functions function is_resource
i tried checking if $result istance of mysqli_result, after been freed $result still mysqli_result object
$db = mysqli_connect("myhost", "myuser", "mypass", "mydb"); $result = $db->query("select * mytable"); $result->free(); var_dump(is_a($result, "mysqli_result")); // => true, if freed
cant wrap in function or method?
class result { private $result; public function __construct(mysqli_result $result) { $this->result = $result; } public function getresult() { return $this->result; } public function free() { $this->result->free(); $this->result = null; } public function __destruct() { $this->free(); } }
Comments
Post a Comment