mysqli_connect
Function • Misc changes in PHP 8.2
Alias of mysqli::__construct.
mysqli_connect Function synopsis
mysqli_connect(
?string $hostname = null,
?string $username = null,
?string $password = null,
?string $database = null,
?int $port = null,
?string $socket = null
): mysqli|false
Parameters
$hostname
OptionalType?stringDefault valuenull
$username
OptionalType?stringDefault valuenull
$password
OptionalType?stringDefault valuenull
$database
OptionalType?stringDefault valuenull
$port
OptionalType?intDefault valuenull
$socket
OptionalType?stringDefault valuenull
Return value
Typemysqli|false
Changes to the mysqli_connect Function
PHP 8.2
- Attribute added for parameter
$password:#[SensitiveParameter]
PHP 8.0
- Return type added:
mysqli|false - Parameter name of parameter #1 changed:
$hostto$hostname - Parameter type added for parameter #1 (
$hostname):?string - Parameter default value added for position #1 (
$hostname):null - Parameter name of parameter #2 changed:
$userto$username - Parameter type added for parameter #2 (
$username):?string - Parameter default value added for position #2 (
$username):null - Parameter type added for parameter #3 (
$password):?string - Parameter default value added for position #3 (
$password):null - Parameter type added for parameter #4 (
$database):?string - Parameter default value added for position #4 (
$database):null - Parameter type added for parameter #5 (
$port):?int - Parameter default value added for position #5 (
$port):null - Parameter type added for parameter #6 (
$socket):?string - Parameter default value added for position #6 (
$socket):null
mysqli_connect(
- $host,
+ ?string $hostname = null,
- $user,
+ ?string $username = null,
- $password,
+ ?string $password = null,
- $database,
+ ?string $database = null,
- $port,
+ ?int $port = null,
- $socket
+ ?string $socket = null
- )
+ ): mysqli|false mysqli_connect Function Availability
mysqli_connect Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |