Regex by Anakim.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,10);
![]()


Rispondi quotando