$searchText = "hai how      are you"; //eg: if there are multiple spaces between words
$searchText = preg_replace("(\s+)", " ", $searchText );
$searchArray =& split( " ", $searchText );
$text = array(0 => 'hai how are all people there',
              1 => 'how are things going ',
              2 => 'are you coming',
              3 => 'how is sam',
              4 => 'testing ggg');
foreach($text as $key=>$elt){
    foreach($searchArray as $searchelt){
        if(strpos($elt,$searchelt)!== FALSE){
            $matches[] =  $key;  //just storing key to avoid memory wastage
            break;
        }                
    }            
}
//print the matched string with help of stored keys
echo '<pre>matched string are as follows: ';
foreach ($matches as $key){
  echo "<br>{$text[$key]}";    
}