Mysqli library offers a number of alternative syntaxes for establishing connection to the MySQL server.
#1
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
# 2
$mysqli = new mysqli();
$mysqli->connect('localhost', 'my_user', 'my_password', 'my_db');
I am not asking about procedural vs OOP style nor am I asking about mysqli_connect()
vs mysqli_real_connect()
.
What is the purpose of the mysqli:connect()
method, and is there any difference between connecting using the first option and the second option?