What best practices should be followed when declaring and using functions in PHP?

When declaring and using functions in PHP, it is important to follow best practices to ensure code readability, reusability, and maintainability. Some best practices include giving functions descriptive names, using proper indentation and formatting, documenting function parameters and return values, avoiding global variables within functions, and keeping functions short and focused on a single task.

// Example of declaring and using a function following best practices

/**
 * Calculate the sum of two numbers
 *
 * @param int $num1 The first number
 * @param int $num2 The second number
 * @return int The sum of the two numbers
 */
function calculateSum($num1, $num2) {
    return $num1 + $num2;
}

// Example usage of the function
$result = calculateSum(5, 10);
echo $result; // Output: 15