How can PHP beginners ensure that their code is properly formatted and indented for readability?

To ensure that PHP code is properly formatted and indented for readability, beginners can use an IDE or text editor with built-in code formatting tools. Additionally, they can follow coding standards such as PSR-1 and PSR-2 which provide guidelines on indentation, spacing, and naming conventions. Regularly reviewing and refactoring code can also help maintain readability.

<?php
// Example code snippet with proper formatting and indentation
function greet($name) {
    echo "Hello, " . $name . "!";
}

$name = "John";
greet($name);
?>