title: How can I check if the value of a textarea has HTML in it using PHP?
body: <p>How can I check if the value of a textarea has HTML in it using PHP?</p>
  
  <p>I have read multiple posts, I tried the following:</p>
  
  <pre><code>if ($text != strip_tags($text))
      // text contains html
  </code></pre>
  
  <p>and tried</p>
  
  <pre><code>if (preg_match("/([\&lt;])([^\&gt;]{1,})*([\&gt;])/i", $string)) { 
      echo "string contains html"; 
  } 
  </code></pre>
  
  <p>and some other regex. But all give the same result. <strong>If I enter only one line (without html)</strong> in the textarea and validate it <strong>it is fine</strong>, it says there is no HTML. <strong>If I enter more lines (even without html tags) it says there are html tags but there aren't</strong>. Is there a transparent <code>&lt;br&gt;</code>? Even when I echo/verify the string no html tag is shown.</p>
  
  <p>How come when I have multiple lines in a textarea without html chars it automatically says there are? Are there any other ways of verifying if there are html tags in a textarea?</p>
  
  <p>Thank you!</p>