How can proper code formatting and indentation improve the readability and maintainability of PHP code?

Proper code formatting and indentation help to improve the readability and maintainability of PHP code by making it easier for developers to understand the structure and flow of the code. Consistent indentation also helps in quickly identifying code blocks and nested structures, which can reduce the chances of errors and make debugging easier.

<?php

// Badly formatted code
function calculateTotal($price,$quantity){
$total=$price*$quantity;
return$total;
}

// Properly formatted code
function calculateTotal($price, $quantity) {
    $total = $price * $quantity;
    return $total;
}

?>