What are some best practices for writing custom functions in PHP?

When writing custom functions in PHP, it is important to follow best practices to ensure readability, reusability, and maintainability of your code. Some best practices include giving meaningful names to your functions, using proper indentation and formatting, documenting your functions with comments, and keeping your functions small and focused on a single task.

// Example of a custom function in PHP following best practices
function calculateSum($num1, $num2) {
    // Calculate the sum of two numbers
    $sum = $num1 + $num2;
    
    return $sum;
}