If you are using persistent connections it won't make any difference but if you are using and closing explicitly managed connections (mysql_connect instead of mysql_pconnect) it will have a significant affect on performance, so keep the connection outside that way you reuse the one connection.
Hope this helps 😉