How to correctly free a PDO instance -
For example:
$ db = new PDO; // using some code $ db here // and after that, I want to free this var and close all connections and $ db = NULL; // How correctly?
Is the correct way to free all SQL results and connections?
You can do this, but often not necessary if a function is created and another If the Vars is not using it, then it will release the content of $ db when it gets out of the scope (usually at the end of the function). If $ db is a global, then it will be released when the script ends.
Comments
Post a Comment