How can a PHP script redirect to another page after execution without using fopen or header?

To redirect to another page after executing a PHP script without using fopen or header, you can use JavaScript to achieve the redirection. By embedding a simple script within the PHP code, you can instruct the browser to redirect to the desired page after the PHP script has finished executing.

<?php
// Your PHP script code here

// Embedding JavaScript for redirection
echo '<script type="text/javascript">window.location = "http://www.example.com/newpage.php";</script>';
?>