Are there specific PHP functions or methods that can be utilized to check the status of a link (e.g., 200 OK vs. 404 Not Found)?

To check the status of a link in PHP, you can use the `get_headers()` function to fetch the HTTP response headers of the URL. This function returns an array of headers where the first element contains the HTTP status code. You can then check this status code to determine if the link is valid (200 OK) or not found (404 Not Found).

$url = "https://example.com";
$headers = get_headers($url);

if(strpos($headers[0], "200") !== false) {
    echo "Link is valid (200 OK)";
} elseif(strpos($headers[0], "404") !== false) {
    echo "Link not found (404 Not Found)";
} else {
    echo "Unknown status";
}