What is the difference between using a meta tag for redirection and the header() function in PHP?

Using a meta tag for redirection involves adding an HTML meta tag within the head section of a webpage to automatically redirect users to another URL after a specified time. On the other hand, the header() function in PHP is used to send a raw HTTP header to the browser, which can be used for various purposes, including redirection. The key difference is that using a meta tag for redirection is done on the client-side, while the header() function in PHP is executed on the server-side.

// Using meta tag for redirection
echo '<meta http-equiv="refresh" content="5;url=http://example.com">';

// Using header() function in PHP for redirection
header('Location: http://example.com');
exit();