public function splitText($text, $len = 200) { $strtolower = $this->mb ? 'mb_strtolower' : 'strtolower'; $text = preg_replace($this->regex, '_', $strtolower($text)); $parts = preg_split("/(.{{$len}})/" . $this->regex_mod, $text, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); if (count($parts) > 1 && strlen(end($parts)) < 100) { array_pop($parts); } return $parts; }