Simple HTML tag _ PHP Tutorial for filtering strings

Source: Internet
Author: User
Simply filter the HTML tags in a string. FunctiondeleteHtml ($ scr) {$ lstrlen ($ scr); for ($ i0; $ I $ l; $ I ++) {if (substr ($ scr, $ I, 1) {current position $ ii $ I; stop the loop function deleteHtml ($ scr) when $ I is greater than the character length)
{
$ L = strlen ($ scr );

For ($ I = 0; $ I <$ l; $ I ++)
{
If (substr ($ scr, $ I, 1) = "<")
{
// Current location
$ Ii = $ I;

// Stop the loop when $ I is longer than the character length
While (substr ($ scr, $ I, 1 )! = ">" & $ I <$ l)
$ I ++;

// At the end of the large string, reset $ I to the start position of '<'.
If ($ I = $ l)
{
$ I = $ ii-1;
// Indicates that the string ends.
$ B = 1;
}

$ I ++;
}


// When the next character is not '<', the character is accepted; otherwise, $ I --, starting from this '<'
If (substr ($ scr, $ I, 1 )! = '<' | $ B = 1)
$ Str = $ str. substr ($ scr, $ I, 1 );
Else
$ I --;
}

Return ($ str );
}

Http://www.bkjia.com/PHPjc/317540.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/317540.htmlTechArticlefunction deleteHtml ($ scr) {$ l = strlen ($ scr); for ($ I = 0; $ I $ l; $ I ++) {if (substr ($ scr, $ I, 1) = "") {// Current position $ ii = $ I; // stop the loop when $ I is longer than the character length...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.