JSON string Simple filter HTML tags in a string

Source: Internet
Author: User
function deletehtml ($SCR)
{
$l = strlen ($SCR);

for ($i =0; $i < $l; $i + +)
{
if (substr ($SCR, $i, 1) = = "<")
{
Current position
$ii = $i;

Stop looping when $i is greater than character length
while (substr ($SCR, $i, 1)! = "> && $i < $l)
$i + +;

Resets the $i to the beginning of the ' < ' when the end of the large string is found
if ($i = = $l)
{
$i = $ii-1;
means the end of the string is reached
$b = 1;
}

$i + +;
}


The next character is not ' < ' to accept the character, otherwise $i--, from this ' < ' at the beginning of the search
if (substr ($SCR, $i, 1)! = ' < ' | | $b = = 1)
$str = $str. substr ($SCR, $i, 1);
Else
$i--;
}

return ($STR);
}

The above describes the JSON string simple filter string in the HTML tag, including the content of the JSON string, I hope to be interested in PHP tutorial friends helpful.

  • 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.