How can the DRY (Don't Repeat Yourself) principle be applied to improve the efficiency of PHP code?

The DRY principle in PHP encourages developers to avoid duplicating code by creating reusable functions or classes. This can improve code efficiency by reducing the amount of code that needs to be written, maintained, and debugged.

// Example of applying the DRY principle by creating a reusable function
function calculateArea($width, $height) {
    return $width * $height;
}

$rectangle1 = calculateArea(5, 10);
$rectangle2 = calculateArea(3, 7);