Pergunta

I cant make strip_tags works, i have really tried to change position, syntax, i usually make it work, but here is not working. why?

<?PHP 
$sum_string = $row_lastitem['summary'];
$sum_string = strip_tags($sum_string);
$sum_string = (strlen($sum_string) > 255) ? substr($sum_string,0,252).'...' : $sum_string;

$sum_string = nl2br($sum_string);

echo $sum_string; ?>

The html is there: like

<p>this is a example</p>
<p>line 2 </p>

Can someone point at my error pls.

Even this wont work

<?PHP 
    $sum_string = $row_lastitem['summary'];
    $sum_string = strip_tags($sum_string);

    echo $sum_string; ?>
Foi útil?

Solução

Ok solution :

Sorry just found in related. Why doesn't strip_tags work in PHP?

html_entity_decode needed. thanks

<?PHP 
$sum_string = $row_lastitem['summary'];


$sum_string = strip_tags(html_entity_decode($sum_string)); ;
$sum_string = (strlen($sum_string) > 255) ? substr($sum_string,0,252).'...' : $sum_string;

$sum_string = nl2br($sum_string);

echo $sum_string; ?>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top