What are some best practices for formatting PHP code to improve readability and maintainability, especially in a forum setting?

When formatting PHP code for improved readability and maintainability in a forum setting, it's important to follow consistent coding standards such as PSR-1 and PSR-2. Use proper indentation, spacing, and naming conventions to make the code easier to understand for others. Additionally, consider breaking down complex code into smaller, more manageable functions and classes.

<?php

// Example of well-formatted PHP code following PSR-1 and PSR-2 standards
function calculateTotal($price, $quantity) {
    $total = $price * $quantity;
    
    return $total;
}

$price = 10;
$quantity = 5;
$total = calculateTotal($price, $quantity);

echo "Total: $total";

?>