What is the difference between using "?" and "& in defining a mail subject in PHP?

When defining a mail subject in PHP, the question mark "?" is used to separate the email address from the subject in the mailto header, while the ampersand "&" is used to separate different parameters in the mailto header. Therefore, when specifying a subject in an email header, it is important to use the question mark to ensure it is properly recognized.

$to = 'recipient@example.com';
$subject = 'Subject of the email';
$headers = 'From: sender@example.com' . "\r\n" .
    'Reply-To: sender@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

// Use the question mark to separate the email address and subject in the mailto header
$mail = mail($to, '=?UTF-8?B?' . base64_encode($subject) . '?=', '', $headers);