strip html and amend tabs and spaces


/ Published in: PHP
Save to your folder(s)

A function to remove tags and to also remove excess spaces.


Copy this code and paste it in your HTML
  1. function stripTagsAmendSpaces($str)
  2. {
  3. $str = trim($str);
  4. $str= strip_tags($str);
  5. return $str = preg_replace('/\\s{2,}/',' ',$str);
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.