Junior — Middle
How can you programmatically direct the browser to load a different URL?
sobes.tech AI
Answer from AI
In PHP, to programmatically redirect the browser to another URL, the header() function is used with the Location header. It is important to call this function before any content is output, otherwise the header will not be sent.
Example:
header('Location: https://example.com');
exit();
exit() is used to terminate the script execution after the redirect.