- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
function strum($text, $simb)
{
if(mb_strlen($text, 'UTF-8') > $simb){
}
if(mb_strlen($text, 'UTF-8') > $simb)
{
$start = 0;
for($i = 0; $i <= (ceil(mb_strlen($text, 'UTF-8') / $simb)); $i++)
{
$tmp = mb_strpos($text, '. ', $start + $simb, 'UTF-8');
if(is_numeric($tmp))
{
$num[] = $tmp;
}
$tmp = mb_strpos($text, '! ', $start + $simb, 'UTF-8');
if(is_numeric($tmp))
{
$num[] = $tmp;
}
$tmp = mb_strpos($text, '? ', $start + $simb, 'UTF-8');
if(is_numeric($tmp))
{
$num[] = $tmp;
}
if($num != '')
{
$end = min($num) + 1;
}
if($end <= $start)
{
$end = mb_strlen($text, 'UTF-8');
}
$str = mb_substr($text, $start, $end, 'UTF-8');
$string[] = mb_substr($str, 0, ($end - $start), 'UTF-8');
$start = $end;
unset($num);
unset($str);
unset($tmp);
if($end == mb_strlen($text, 'UTF-8'))
{
break;
}
}
}
else
{
$string[] = $text;
}
return $string;
}
striker 16.08.2009 14:49 # 0