In the provided code snippet, what improvements can be made to optimize the deletion process of database entries using PHP?

The issue with the current code snippet is that it is executing a separate SQL query for each entry to be deleted from the database. This can be optimized by using a single SQL query with the IN clause to delete multiple entries at once. This will reduce the number of queries executed and improve the efficiency of the deletion process.

// Get the array of IDs to be deleted
$ids = [1, 2, 3, 4, 5];

// Construct a comma-separated list of IDs
$ids_str = implode(',', $ids);

// Construct and execute a single SQL query to delete multiple entries
$sql = "DELETE FROM table_name WHERE id IN ($ids_str)";
$result = mysqli_query($conn, $sql);

if($result) {
    echo "Entries successfully deleted.";
} else {
    echo "Error deleting entries: " . mysqli_error($conn);
}