<?php

error_reporting(-1);

$text = <<<EOF
Нет пробела после запятой,Либо после точки с запятой;а иногда и даже после таких знаков:восклицательного!И даже вопросительного.Найдет ли мой скрипт такую ошибку?Посмотрим.
"Жи" и "ши" мы пишем с буквой "и" в словах "шына", "жывотное" и др.
В тексте есть слово "координально", "сдесь", "зделал", "зделан" а также "зделаю" но нет слова "чюдо" и "щюка".
EOF
;

$regexp = '/([а-яё]+)(,|;|!|\\.|\\?|\\:)([а-яё]+)/ui';
$text = checking($text, $regexp, 7);
$regexp = '/\bз(д[а-яё]+)\b/ui';
$text = checking($text, $regexp, 2);
$regexp = '/([а-яё]*ж|ш)ы([а-яё]*)/ui';
$text = checking($text, $regexp, 3);
$regexp = '/([а-яё]*ч|щ)ю([а-яё]*)/ui';
$text = checking($text, $regexp, 4);
$regexp = '/сдесь/ui';
$text = checking($text, $regexp, 5);
$regexp = '/координал[а-яё]+/ui';
$text = checking($text, $regexp, 6);
$regexp = '/([^,;.])( )(а|но) /';
$text = checking($text, $regexp, 1);

echo $text;

function checking($text, $regexp, $type){
    $error = false;
    $matches = array();
    $count = preg_match_all($regexp, $text, $matches);
    foreach ($matches[0] as $element){
        echo "В тексте найдена ошибка: {$element}\n";
        $error = true;
        //echo "$count\n";
        //var_dump($matches);
    }
    if ($error == true){
        $text = fixError($text, $regexp, $type);
        return $text;
    }
}

function fixError($text, $regexp, $type){
    if ($type == 5){
        $text = preg_replace($regexp, 'здесь', $text);    
    }else if($type == 6){
        $text = preg_replace($regexp, 'кардинально', $text);
    }else if($type == 4){
        $text = preg_replace($regexp, '$1у$2', $text);
    }else if($type == 3){
        $text = preg_replace($regexp, '$1и$2', $text);
    }else if($type == 2){
        $text = preg_replace($regexp, 'c$1', $text);
    }else if($type == 1){
        $text = preg_replace($regexp, '$1, $3 ', $text);
    }else if($type == 7){
        $text = preg_replace($regexp, '$1$2 $3', $text);
    }
    
    return $text;
}