What are some best practices for formatting and organizing PHP code to avoid syntax errors?

To avoid syntax errors in PHP code, it is essential to follow best practices for formatting and organization. This includes using consistent indentation, proper spacing, and clear naming conventions. Additionally, it is crucial to pay attention to opening and closing brackets, parentheses, and quotes to ensure they are properly matched.

<?php

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

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

?>