PHP/HTML/HTML String

Материал из Web эксперт
Перейти к: навигация, поиск

Escape HTML char

   <source lang="html4strict">

<?php

  $input = "I just can"t get <<enough>> of PHP!";
  echo htmlspecialchars($input);

?>


      </source>
   
  


HTML tag strip

   <source lang="html4strict">

<?php

  $input = "This <a href="http://www.wbex.ru/">wbex</a> is  !";
  echo strip_tags($input, "<a>");

?>


      </source>
   
  


strip_tags: strip tags from html string

   <source lang="html4strict">

<?php

  $input = "Email <a href="spammer@example.ru">spammer@example.ru</a>";
  echo strip_tags($input);

?>


      </source>