<?php
//$text = "ну что. не смотрел еще black mesa. я собирался скачать ,но все как-то некогда было.";
// Для тестов
$text = 'roses are red , nd violets are blue . whatever you do i\'ll keep it for you.';
//$text = 'привет.есть 2 функции,preg_split и explode ,не понимаю,в чем между ними разница.';
/* Делает первую букву в строке заглавной */
function makeFirstLetterUppercase($text) {
//$space = explode('.', $text);
$text = preg_replace('/(\w)[\s?]*\,[\s?]*(\w)/u', '$1, $2', $text);
foreach ($text as $key => $value) {
$word = $firstLetter.$word;
}
return $output;
}
/* исправляет текст */
function fixText($text) {
$output = makeFirstLetterUppercase($text);
return $text;
}
$result = fixText($text);
echo "{$result}\n";
PD9waHAKIAplcnJvcl9yZXBvcnRpbmcoLTEpOwptYl9pbnRlcm5hbF9lbmNvZGluZygndXRmLTgnKTsKIAovLyR0ZXh0ID0gItC90YMg0YfRgtC+LiAgICAgINC90LUg0YHQvNC+0YLRgNC10Lsg0LXRidC1IGJsYWNrIG1lc2EuINGPINGB0L7QsdC40YDQsNC70YHRjyDRgdC60LDRh9Cw0YLRjCAgLNC90L4g0LLRgdC1INC60LDQui3RgtC+INC90LXQutC+0LPQtNCwINCx0YvQu9C+LiI7Ci8vINCU0LvRjyDRgtC10YHRgtC+0LIKJHRleHQgPSAncm9zZXMgYXJlIHJlZCAgICwgIG5kIHZpb2xldHMgYXJlIGJsdWUgICAgLiAgICAgd2hhdGV2ZXIgeW91IGRvIGlcJ2xsIGtlZXAgaXQgZm9yIHlvdS4nOwovLyR0ZXh0ID0gJ9C/0YDQuNCy0LXRgi7QtdGB0YLRjCAyINGE0YPQvdC60YbQuNC4LHByZWdfc3BsaXQg0LggZXhwbG9kZSAs0L3QtSDQv9C+0L3QuNC80LDRjizQsiDRh9C10Lwg0LzQtdC20LTRgyDQvdC40LzQuCDRgNCw0LfQvdC40YbQsC4nOwogCi8qINCU0LXQu9Cw0LXRgiDQv9C10YDQstGD0Y4g0LHRg9C60LLRgyDQsiDRgdGC0YDQvtC60LUg0LfQsNCz0LvQsNC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