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

To ensure readability and maintainability of PHP code, it is important to follow consistent formatting practices. This includes using proper indentation, spacing, and commenting to make the code easier to understand for yourself and others who may need to work on it in the future.

<?php

// Good example of properly formatted PHP code
function calculateSum($num1, $num2) {
    $sum = $num1 + $num2;
    return $sum;
}

$result = calculateSum(5, 10);
echo "The sum is: " . $result;

?>