What correction was made to the PHP script to ensure it only reacts to specific words and not partial matches?

The issue of the PHP script reacting to partial matches can be solved by using the `preg_match` function with word boundaries `\b` to ensure it only matches complete words. This will prevent the script from reacting to partial matches of the specified words.

$message = "This is a test message containing the word test";

$words = array("test", "word");

foreach ($words as $word) {
    if (preg_match("/\b$word\b/", $message)) {
        echo "The word $word was found in the message.";
    }
}