Advertisement
yudhaez0212

Untitled

Dec 10th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. function htmlDecode($html) {
  2. $search = array(
  3. '/\>[^\S ]+/s', // strip whitespaces after tags, except space
  4. '/[^\S ]+\</s', // strip whitespaces before tags, except space
  5. '/(\s)+/s', // shorten multiple whitespace sequences
  6. // '/<!--(.|\s)*?-->/' // Remove HTML comments
  7. );
  8. $replace = array('>', '<', '\\1', '');
  9. $html = preg_replace($search, $replace, $html);
  10.  
  11. return $html;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement