W3cubDocs

/PHP

mysqli::close

mysqli_close

(PHP 5, PHP 7)

mysqli::close -- mysqli_closeCloses a previously opened database connection

Description

Object oriented style

public mysqli::close ( ) : bool

Procedural style

mysqli_close ( mysqli $link ) : bool

Closes a previously opened database connection.

Open non-persistent MySQL connections and result sets are automatically destroyed when a PHP script finishes its execution. So, while explicitly closing open connections and freeing result sets is optional, doing so is recommended. This will immediately return resources to PHP and MySQL, which can improve performance. For related information, see freeing resources

Parameters

link

Procedural style only: A link identifier returned by mysqli_connect() or mysqli_init()

Return Values

Returns true on success or false on failure.

Examples

See mysqli_connect().

Notes

Note:

mysqli_close() will not close persistent connections. For additional details, see the manual page on persistent connections.

See Also

© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/mysqli.close.php