How can a PHP script be properly terminated to prevent further execution after sending a header?

When sending a header in PHP, it is important to terminate the script to prevent any further output that could interfere with the header. This can be done by using the `exit()` or `die()` functions immediately after sending the header.

<?php
header("Location: https://www.example.com");
exit();
?>