Best to explain by example:
public function runRequest()
{
$ch = curl_init();
//.... Set Curl Options ....
$response = curl_exec($ch);
if ($response === false)
throw new Exception('Boom! A feck, didnt close $ch');
curl_close($ch);
}
Just wondering is this safe? will the $ch be handled properly.
If not, I can change $ch
to be a class variable, and destroy in the destructor.
Thoughts? thanks in advance