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

To ensure readability and maintainability of PHP code, it is important to follow consistent formatting and indentation practices. This includes using spaces instead of tabs for indentation, using a standard indent size (such as 4 spaces), and properly aligning code blocks and elements. Additionally, using meaningful variable and function names, commenting code sections, and organizing code into logical sections can greatly improve code readability.

<?php

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

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

?>