What is the purpose of PHPDoc and how is it used in PHP programming?

PHPDoc is a documentation generator that allows developers to document their PHP code using special comment blocks. These comments provide information about the purpose of functions, classes, and methods, as well as details about parameters, return values, and exceptions that may be thrown. PHPDoc helps improve code readability, maintainability, and allows for automatic generation of documentation from the codebase.

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