<?php
$text = "ну что. не смотрел еще black mesa.я собирался скачать ,но все как-то некогда было.";
// Для тестов
//$text = "roses are red,and violets are blue.whatever you do i'll keep it for you.";
//$text = 'привет.есть 2 функции,preg_split и explode ,не понимаю,в чем между ними разница.';
function makeFirstLetterUppercase($splitText, $encoding = 'utf-8') {
foreach($splitText as $key => $value) {
$splitText[$key] = $value;
}
return $splitText;
}
function fixText($splitText) {
foreach($splitText as $key => $value){
$value = $value . '. ';
$splitText[$key] = $value;
}
return $splitText;
}
$splitText = preg_split('/[.!?]\\s*/', $text, 0, PREG_SPLIT_NO_EMPTY
); $splitText = fixText(makeFirstLetterUppercase($splitText));
foreach ($splitText as $key => $value) {
echo $value;
}
PD9waHAKbWJfaW50ZXJuYWxfZW5jb2RpbmcoJ3V0Zi04Jyk7CiR0ZXh0ID0gItC90YMg0YfRgtC+LiAgICAgINC90LUg0YHQvNC+0YLRgNC10Lsg0LXRidC1IGJsYWNrIG1lc2Eu0Y8g0YHQvtCx0LjRgNCw0LvRgdGPINGB0LrQsNGH0LDRgtGMICAs0L3QviDQstGB0LUg0LrQsNC6LdGC0L4g0L3QtdC60L7Qs9C00LAg0LHRi9C70L4uIjsKLy8g0JTQu9GPINGC0LXRgdGC0L7QsgovLyR0ZXh0ID0gInJvc2VzIGFyZSByZWQsYW5kIHZpb2xldHMgYXJlIGJsdWUud2hhdGV2ZXIgeW91IGRvIGknbGwga2VlcCBpdCBmb3IgeW91LiI7Ci8vJHRleHQgPSAn0L/RgNC40LLQtdGCLtC10YHRgtGMIDIg0YTRg9C90LrRhtC40LgscHJlZ19zcGxpdCDQuCBleHBsb2RlICzQvdC1INC/0L7QvdC40LzQsNGOLNCyINGH0LXQvCDQvNC10LbQtNGDINC90LjQvNC4INGA0LDQt9C90LjRhtCwLic7CmZ1bmN0aW9uIG1ha2VGaXJzdExldHRlclVwcGVyY2FzZSgkc3BsaXRUZXh0LCAkZW5jb2RpbmcgPSAndXRmLTgnKSB7CiAgICBmb3JlYWNoKCR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