What are some best practices for creating and sharing functions in PHP?

When creating and sharing functions in PHP, it is important to follow best practices to ensure readability, reusability, and maintainability of your code. Some best practices include using descriptive function names, keeping functions concise and focused on a single task, documenting your functions with comments, and organizing functions into logical groupings.

// Example of a well-documented and organized PHP function

/**
 * 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;
}