title: array_intersect() Argument is not an array
body: <p>I have developed this small code to check if 2 text, one from a database and the other from an outside imput have common words.
  The problem is that I get a message "Argument is not an array".
  I cannot see where is the problem.
  I also need to check if the 2 messages if should have the same words are in the same sequence.
  Please help to understand where is the mistake.
  Thanks</p>
  
  <pre><code>$checkMsg=strip_tags($_POST['checkMsg']); // message from input form
  $message // message from database
  $MsgWords = preg_split("/[\s,]+/", $checkMsg);
  if(!empty($checkMsg)){
           foreach ($MsgWords as $Neword)
        {           $Neword = trim($Neword);
  
            echo " $Neword";
        }
            $word = preg_split("/[\s,]+/", $message);
  
        foreach ($word as $currentWord)
               {
                                        $currentWord = trim($currentWord);
  
                   echo "  $currentWord"; 
              }
  
  
              $intersect=array_intersect( $Neword ,
                                          $currentWord);
                      echo" Your common words are: $intersect";}else{echo "No common words";}
  </code></pre>