How can PHP be used to extract a specific word before a period in a URL?

To extract a specific word before a period in a URL using PHP, you can use the `parse_url` function to get the hostname from the URL, and then use `explode` to split the hostname by periods. You can then access the word before the last period by getting the second-to-last element in the array.

$url = "https://www.example.com";
$hostname = parse_url($url, PHP_URL_HOST);
$parts = explode(".", $hostname);
$specific_word = $parts[count($parts) - 2]; // Get the word before the last period
echo $specific_word;