tags:

views:

32

answers:

1

for example:

$db = new PDO();
// some code using $db here
// and next, i want to free this var and close all connection and so on
$db = NULL; // or how correctly?

Is that correct way to free all SQL results and connections?

A: 

you could do that, but often not necessary. if created in a function and no other vars are using it, $db will release its contents when it goes out of scope (usually at the end of the function). if $db is a global, it will be released when the script ends.

jspcal