When dealing with something like that, I find it is useful to build an associative array. Then you just have to look up the element in the array. The lookup happens to be very fast, which is a good thing if you need to do multiple lookups. Simple array lookups are also easy to understand when you're looking at the code...
// First, build an associative array
$responses_by_input = array();
foreach ($lines_from_file as $line) {
list($input, $response) = explode('|', $line);
$responses_by_input[$input] = $response;
}
// Now get the correct response from the array
$input = $_GET['user_text'];
if (isset($responses_by_input[$input])) {
echo $responses_by_input[$input];
}
else {
echo 'Excuse me?';
}