How can the first word of a string be extracted and styled differently in CSS compared to the rest of the string in PHP?

To extract and style the first word of a string differently in CSS compared to the rest of the string in PHP, you can use PHP functions to separate the first word from the rest of the string, and then apply different CSS classes or inline styles to each part. One way to achieve this is by using PHP's `explode()` function to split the string into an array of words, and then accessing the first element of the array to style it differently. You can then concatenate the styled first word with the rest of the string and output it with appropriate HTML tags and CSS classes.

```php
<?php
$string = "Hello World!";
$words = explode(" ", $string);
$first_word = "<span class='first-word'>" . $words[0] . "</span>";
$rest_of_string = implode(" ", array_slice($words, 1));

echo "<p>{$first_word} {$rest_of_string}</p>";
?>
```

In the above code snippet, we first split the string into an array of words using `explode()`, then style the first word with a CSS class `first-word`. Finally, we concatenate the styled first word with the rest of the string and output it within a paragraph tag.