As for testing the string for the existence of key words, you could either use regex or the normal strpos() function. Regex gets a bit confusing, but it is way more powerful that most of the PHP string searching functions. Here is an example of using the strpos() function to figure out which answer to give:
$input = 'whats the weather like';
if (strpos($input, 'whats') &&
strpos($input, 'weather') &&
strpos($input, 'today'))
{$message = $todaysWeatherData;}
if (strpos($input, 'whats') &&
strpos($input, 'weather') &&
strpos($input, 'tomorrow'))
{$message = $forcastWeatherData;}
if (strpos($input, 'how') &&
strpos($input, 'tie') &&
strpos($input, 'shoes') ||
(strpos($input, 'half') && strpos($message, 'hitch')))
{$message = $commonKnots;}
You can get pretty fancy with the logic, but it can also get cumbersome if you intend to create a virtual help assistant. I recommend reading up on PCRE (Perl Compatible Regular Expressions).