Home >Backend Development >PHP Tutorial >json string simple filter HTML tags in string
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 the character length
while( substr( $scr, $i, 1 ) ! = ">" && $i < $l )
$i++;
// When reaching the end of the large string, reset $i to the starting position of '<' if ( $i == $ l )
. Accept characters, otherwise $i--, start searching from this '<' if ( substr( $scr, $i, 1 ) != '<' || $b == 1 )
$str = $ str . substr( $scr, $i, 1 );
else
$i--;
}
}