What are the best practices for structuring PHP code to maintain readability and debugging ease?

When structuring PHP code for readability and ease of debugging, it is important to follow a consistent coding style, use meaningful variable names, and properly comment your code. Additionally, breaking down complex tasks into smaller functions or classes can improve code organization and maintainability.

<?php

// Example of well-structured PHP code
function calculateTotal($price, $quantity) {
    $total = $price * $quantity;
    return $total;
}

$price = 10;
$quantity = 5;
$total = calculateTotal($price, $quantity);

echo "Total: $total";

?>