This is my code:
if (preg_match('/^.{1,22}\b/s', $myString, $match)) {
$name = $match[0];
}
It cuts a string after 22 chars and at a whitespace. Problem is, it does not work if there are unmlauts like ü in the string.
- That works: Lorem ipsum dolor sit amet
- That does not work: 12345678 - Schlüsselband
Any ideas how to fix that?