What are the differences between using HTTP/1.1 302 Found and HTTP/1.1 301 Moved Permanently headers in PHP for URL redirection, and how do they affect the browser's display of the URL?

When redirecting URLs in PHP, using HTTP/1.1 301 Moved Permanently header tells the browser that the requested resource has permanently moved to a new location, and it should update its bookmarks and links accordingly. On the other hand, using HTTP/1.1 302 Found header tells the browser that the requested resource has temporarily moved to a new location. This can affect how search engines index the URL and how bookmarks are saved by the browser.

// Redirect using HTTP/1.1 301 Moved Permanently header
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newurl.com");

// Redirect using HTTP/1.1 302 Found header
header("HTTP/1.1 302 Found");
header("Location: http://www.newurl.com");