exception handling - PHP finally clause -
what best practice simulate clause? realize considered related (though don't think it's duplicate) of this question.
however, in case want handle exceptions, want use (or whatever php equivalent or practice) defined python:
a clause executed before leaving try statement, whether exception has occurred or not.
just loosely writing code after try-catch block seems ugly practice me.
in rfc adding php, suggest workaround:
<?php $db = mysqli_connect(); try { call_some_function($db); } catch (exception $e) { mysqli_close($db); throw $e; } mysql_close($db);
so unless upgrade php 5.5 (which contain finally
construct), best option.
Comments
Post a Comment