<?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( $text ) {
$text = preg_split ( '#[?!.]#u' , $text , - 1 , PREG_SPLIT_NO_EMPTY
) ; foreach ( $text as $key => $letter ) {
$text [ $key ] = trim ( $letter ) ; $text [ $key ] = preg_split ( '//u' , $letter , - 1 , PREG_SPLIT_NO_EMPTY
) ; $text [ $key ] = implode ( "" , $text [ $key ] ) ; echo "$input \n " ; }
return $text ;
}
/* исправляет текст */
function fixText( $text ) {
$text = makeFirstLetterUppercase( $text ) ;
$reg = '#([А-Я]\\.)#u' ;
return $text ;
}
$result = fixText( $text ) ;
echo "{$result} \n " ;
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7Cm1iX2ludGVybmFsX2VuY29kaW5nKCd1dGYtOCcpOwoKJHRleHQgPSAi0L3RgyDRh9GC0L4uICAgICAg0L3QtSDRgdC80L7RgtGA0LXQuyDQtdGJ0LUgYmxhY2sgbWVzYS7RjyDRgdC+0LHQuNGA0LDQu9GB0Y8g0YHQutCw0YfQsNGC0YwgICzQvdC+INCy0YHQtSDQutCw0Lot0YLQviDQvdC10LrQvtCz0LTQsCDQsdGL0LvQvi4iOwovLyDQlNC70Y8g0YLQtdGB0YLQvtCyCi8vICR0ZXh0ID0gJ3Jvc2VzIGFyZSByZWQsYW5kIHZpb2xldHMgYXJlIGJsdWUud2hhdGV2ZXIgeW91IGRvIGknbGwga2VlcCBpdCBmb3IgeW91Lic7Ci8vICR0ZXh0ID0gJ9C/0YDQuNCy0LXRgi7QtdGB0YLRjCAyINGE0YPQvdC60YbQuNC4LHByZWdfc3BsaXQg0LggZXhwbG9kZSAs0L3QtSDQv9C+0L3QuNC80LDRjizQsiDRh9C10Lwg0LzQtdC20LTRgyDQvdC40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