By Anakin:
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";
echo stringTransform($testo,50);
![]()


Rispondi quotando