How can PHP tags and formatting be used effectively to improve code readability and maintainability?

Using proper PHP tags and formatting can greatly improve code readability and maintainability. It is important to use consistent indentation, spacing, and naming conventions to make the code easier to understand for yourself and other developers. Additionally, using PHP tags like <?php and ?> appropriately can help clearly delineate PHP code from HTML or other languages within a file.

&lt;?php

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

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

?&gt;