What are best practices for formatting SQL queries in PHP to improve readability and maintainability?

When formatting SQL queries in PHP, it is important to use proper indentation, line breaks, and spacing to improve readability and maintainability. One common practice is to break long queries into multiple lines to make them easier to read. Additionally, using prepared statements with placeholders can help prevent SQL injection attacks and make the code more secure.

// Example of formatting SQL query in PHP for readability and maintainability

$query = "SELECT column1, column2, column3
          FROM table
          WHERE condition = :value";

$stmt = $pdo->prepare($query);
$stmt->bindParam(':value', $value);
$stmt->execute();