codice:
$stringa='ciao mi chiamo pino e vengo da lontano';
preg_match("/^(?=(.{1,20})\b)/s",$stringa,$mth);
echo $mth[1];