In PHP, what are some common techniques for reusing functions within different parts of a program?

To reuse functions within different parts of a program in PHP, you can create a separate PHP file containing the function definitions and then include that file in the parts of the program where you need to use those functions. This allows you to avoid duplicating code and ensures that any changes to the function logic only need to be made in one place.

// functions.php
<?php

function greet($name) {
    echo "Hello, $name!";
}

function calculateArea($length, $width) {
    return $length * $width;
}

?>

// index.php
<?php

include 'functions.php';

greet('John');
echo "\n";

$area = calculateArea(5, 10);
echo "Area: $area";

?>