What are the best practices for formatting and indenting PHP code for readability?

To ensure readability in PHP code, it is important to follow consistent formatting and indentation practices. This includes using spaces instead of tabs for indentation, maintaining a consistent indent level (usually 4 spaces), using proper spacing around operators and control structures, and breaking long lines of code into multiple lines for improved readability.

<?php

// Example of well-formatted PHP code
function calculateSum($num1, $num2) {
    $sum = $num1 + $num2;
    
    if ($sum > 10) {
        echo "The sum is greater than 10";
    } else {
        echo "The sum is less than or equal to 10";
    }
}

calculateSum(5, 7);

?>