Ciao.
da una regex di AnĒkin
diffusore nicola75ss
un grazie a tutti e due.
Ho questa funzione:
Codice PHP:
function stringTransform($str,$len) {
    if(
strlen($str)>$len){
        
preg_match("/^(?=(.{{$len},}?\b))/s",$str,$chunked); 
        
$str$chunked[1].'...';
    }
    return 
$str;
}
$testo "

Opera powers the Web on any device.Surfe the full Web and create dynamic applications using Web technology with Opera 9 for Devices</p>"
;
echo 
stringTransform($testo,50); 
da utilizzare come mostra preambolo in un
blog.
C'č un modo per chiudere un tag che sta
all'interno della stringa sempre che ci sia
basterebbe con il tag

e <a>
esempio di strighe:
"

Opera powers the </p>"
"Opera powers the "
"

Opera here powers the </p>"