Q: what is the difference between mysql_close() and unset()? I am learning php and Mysql database. All are sound good. But the following code make me confused :
if(isset($connection)){
           mysql_close($connection);
           unset($connection);
}

As far I know mysql_close() function is responsible to close a connection. So why additional unset() function has been used here? please explain it. thanks in advance.   

A: *

*mysql_close($connection) closes the non-persistent connection to the MySQL server that's associated with $connection. If $connection isn't specified, the last opened link is used. 
-this function is deprecated , so please use PDO or mysqli.

*unset($connection) clears the pointer to the result on php's side, but does not do anything to the result it points to.

A: The additional unset() would allow the garbage collection to clear up the memory that the closed $connection variable is taking up, also (most likely) your application codes do more if (isset(...)) conditionals on that variable too.

A: unset($connection) will just make the var $connection equal to NULL. If you didn't do the unset, then the var $connection would still point to a MySQL link identifier, which would be invalid after the mysql_close(). It's a little pedantic; whether you unset or not, the $connection var will not be usable after the mysql_close().
