<?php
function grammar( $text ) {
'/.{3}?[,.!?:;][^ ].{3}?/ui' => "Нет пробела после знака препинания" ,
'/.{3}?[жш]ы.{3}?/ui' => "Ж и Ш пишутся с буквой И" ,
'/.{3}?[^.,!?] (а|но).{3}?/ui' => "Нет знака препинания перед А или НО" ,
'/.{3}?(сдесь|координально|зделаю).{3}?/ui' => "Неправильно написано слово"
) ;
foreach ( $rules as $regexp => $desc ) {
$imp = implode ( " и вот тут -" , $matches [ 0 ] ) ; echo "{$desc} вот тут - {$imp} \n " ;
}
}
}
$text = "Алах вилик!а я сука, но не азаза. !Жырная жопа жи. Сдесь ." ;
$test = grammar( $text ) ;
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7CgpmdW5jdGlvbiBncmFtbWFyKCR0ZXh0KSB7CgkkcnVsZXMgPSBhcnJheSgKCScvLnszfT9bLC4hPzo7XVteIF0uezN9Py91aScgPT4gItCd0LXRgiDQv9GA0L7QsdC10LvQsCDQv9C+0YHQu9C1INC30L3QsNC60LAg0L/RgNC10L/QuNC90LDQvdC40Y8iLCAKCScvLnszfT9b0LbRiF3Riy57M30/L3VpJyA9PiAi0JYg0Lgg0Kgg0L/QuNGI0YPRgtGB0Y8g0YEg0LHRg9C60LLQvtC5INCYIiwgCgknLy57M30/W14uLCE/XSAo0LB80L3QvikuezN9Py91aScgPT4gItCd0LXRgiDQt9C90LDQutCwINC/0YDQtdC/0LjQvdCw0L3QuNGPINC/0LXRgNC10LQg0JAg0LjQu9C4INCd0J4iLAoJJy8uezN9PyjRgdC00LXRgdGMfNC60L7QvtGA0LTQuNC90LDQu9GM0L3QvnzQt9C00LXQu9Cw0Y4pLnszfT8vdWknID0+ICLQndC10L/RgNCw0LLQuNC70YzQvdC+INC90LDQv9C40YHQsNC90L4g0YHQu9C+0LLQviIgCgkpOwoJZm9yZWFjaCAoJHJ1bGVzIGFzICRyZWdleHAgPT4gJGRlc2MpIHsKCQkkbWF0Y2hlcyA9IGFycmF5KCk7CgkJaWYgKHByZ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