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