What are some best practices for formatting and indenting PHP code to improve readability and maintainability?

When formatting and indenting PHP code, it is important to follow a consistent style to improve readability and maintainability. One common practice is to use spaces for indentation instead of tabs, typically using 4 spaces for each level of indentation. Additionally, using proper spacing around operators, braces, and control structures can make the code easier to read.

<?php

// Example of properly formatted and indented PHP code
function greet($name) {
    if ($name === 'Alice') {
        echo 'Hello, Alice!';
    } else {
        echo 'Hello, ' . $name . '!';
    }
}

$name = 'Bob';
greet($name);

?>