When and why should header comments be used in PHP code?

Header comments should be used in PHP code to provide information about the purpose of the code, the author, creation date, and any other relevant details. This helps other developers understand the code more easily and maintain it effectively. Header comments are especially important in larger projects or when working in a team to ensure code readability and maintainability.

<?php
/**
 * This PHP script calculates the sum of two numbers.
 *
 * Author: John Doe
 * Date: 2022-01-01
 */

$number1 = 5;
$number2 = 10;

$sum = $number1 + $number2;

echo "The sum of $number1 and $number2 is: $sum";
?>