<?php
$test [ ] = "ну что. не смотрел еще black mesa.я собирался скачать ,но все как-то некогда было." ;
$test [ ] = "roses are red,and violets are blue.whatever you do i'll keep it for you." ;
$test [ ] = "привет.есть 2 функции,preg_split и explode ,не понимаю,в чем между ними разница." ;
function makeFirstLetterUppercase( $text ) {
}
function addSpacingInPunctuation( $text ) {
}
/* исправляет текст */
function fixText( $text ) {
$matches = preg_split ( "/(?<=[!?.])\\ s*(?=\\ w\\ d)/u" , $text ) ; $matches = array_map ( 'makeFirstLetterUppercase' , $matches ) ; $matches = array_map ( 'addSpacingInPunctuation' , $matches ) ;
}
foreach ( $test as $text ) {
$result = fixText( $text ) ;
echo "{$result} \n " ;
}
?>
PD9waHAKCWVycm9yX3JlcG9ydGluZygtMSk7CgltYl9pbnRlcm5hbF9lbmNvZGluZygndXRmLTgnKTsKCSR0ZXN0ID0gYXJyYXkoKTsKIAkkdGVzdFtdID0gItC90YMg0YfRgtC+LiAgICAgINC90LUg0YHQvNC+0YLRgNC10Lsg0LXRidC1IGJsYWNrIG1lc2Eu0Y8g0YHQvtCx0LjRgNCw0LvRgdGPINGB0LrQsNGH0LDRgtGMICAs0L3QviDQstGB0LUg0LrQsNC6LdGC0L4g0L3QtdC60L7Qs9C00LAg0LHRi9C70L4uIjsKCSR0ZXN0W10gPSAicm9zZXMgYXJlIHJlZCxhbmQgdmlvbGV0cyBhcmUgYmx1ZS53aGF0ZXZlciB5b3UgZG8gaSdsbCBrZWVwIGl0IGZvciB5b3UuIjsKCSR0ZXN0W10gPSAi0L/RgNC40LLQtdGCLtC10YHRgtGMIDIg0YTRg9C90LrRhtC40LgscHJlZ19zcGxpdCDQuCBleHBsb2RlICzQvdC1INC/0L7QvdC40LzQsNGOLNCyINGH0LXQvCDQvNC10LbQtNGDINC90LjQvNC4INGA0LDQt9C90LjRhtCwLiI7CgkgCglmdW5jdGlvbiBtYWtlRmlyc3RMZXR0ZXJVcHBlcmNhc2UoJHRleHQpIHsKCSAgICByZXR1cm4gbWJfc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