How can string concatenation improve the readability and maintainability of PHP code when constructing SQL queries?

Using string concatenation in PHP when constructing SQL queries can improve readability and maintainability by allowing the query to be broken down into multiple lines, making it easier to read and understand. Additionally, using concatenation makes it easier to dynamically build queries by adding or removing conditions as needed.

// Example of using string concatenation to construct an SQL query
$sql = "SELECT * FROM users WHERE 1=1";
if ($username) {
    $sql .= " AND username = '$username'";
}
if ($email) {
    $sql .= " AND email = '$email'";
}
if ($status) {
    $sql .= " AND status = '$status'";
}