What are the differences between "mssql_connect" and "sqlsrv_connect" for connecting to SQL Server in PHP?

The main difference between "mssql_connect" and "sqlsrv_connect" is that "mssql_connect" is the older, deprecated function for connecting to SQL Server in PHP, while "sqlsrv_connect" is the newer, recommended function that supports the latest features and improvements. It is recommended to use "sqlsrv_connect" for better performance, security, and compatibility with newer versions of SQL Server.

// Using sqlsrv_connect to connect to SQL Server
$serverName = "localhost";
$connectionOptions = array(
    "Database" => "database_name",
    "Uid" => "username",
    "PWD" => "password"
);
$conn = sqlsrv_connect($serverName, $connectionOptions);

if ($conn) {
    echo "Connected to SQL Server successfully";
} else {
    echo "Connection could not be established";
}