Are there any specific advantages or disadvantages of using new mysqli or mysqli_connect in PHP projects?

When working on PHP projects, using the newer mysqli functions (such as mysqli_connect) over the old mysql functions is recommended due to improved security features and better support for newer MySQL features. However, the mysqli functions may require a bit more code compared to the mysql functions. To connect to a MySQL database using mysqli_connect in PHP:

$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);

// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";