How can the EVA principle be applied to improve the readability and maintainability of PHP code?

Issue: The EVA principle (Eliminate, Validate, Automate) can be applied to improve the readability and maintainability of PHP code by removing unnecessary code, validating input data to prevent errors, and automating repetitive tasks to streamline the development process. Code snippet:

// Eliminate unnecessary code
// Before:
if ($condition == true) {
    doSomething();
} else {
    // do nothing
}

// After:
if ($condition == true) {
    doSomething();
}

// Validate input data
// Before:
$userInput = $_POST['user_input'];
if (!empty($userInput)) {
    // process user input
}

// After:
if (isset($_POST['user_input'])) {
    $userInput = $_POST['user_input'];
    // process user input
}

// Automate repetitive tasks
// Before:
$numbers = [1, 2, 3, 4, 5];
foreach ($numbers as $number) {
    echo $number;
}

// After:
$numbers = [1, 2, 3, 4, 5];
array_map(function($number) {
    echo $number;
}, $numbers);