原代码片段：
```php
function connect_to_db() {
    $connection = new mysqli("localhost", "user", "password", "database");
    if ($connection->connect_error) {
        die("Connection failed: " . $connection->connect_error);
    }
    return $connection;
}
```
修改要求：改写为更加简洁、更便于阅读的格式，并新增连接成功时的输出提示。
user
```php
function connect_to_db() {
    $conn = new mysqli("localhost", "user", "password", "database");
    if ($conn->connect_error) {
        die("连接失败: " . $conn->connect_error);
    }
    echo "连接成功";
    return $conn;
}
```
assistant