<?php
//автозамена
$sentences = ['ты дурак', 'ты дУрАк', 'ты дyрaк', 'ты д у p а к'];
$regexp = "/д *?[уy] *?[рp] *?[аa] *?к/ui";
foreach ($sentences as $sentence)
{
echo "$sentence - ";
$result = preg_replace($regexp, "великолепный человек", $sentence); echo "$result\n";
}
PD9waHAKCi8v0LDQstGC0L7Qt9Cw0LzQtdC90LAKCiRzZW50ZW5jZXMgPSBbJ9GC0Ysg0LTRg9GA0LDQuicsICfRgtGLINC00KPRgNCQ0LonLCAn0YLRiyDQtHnRgGHQuicsICfRgtGLINC0INGDICBwICDQsCDQuiddOwoKJHJlZ2V4cCA9ICIv0LQgKj9b0YN5XSAqP1vRgHBdICo/W9CwYV0gKj/Qui91aSI7CiRtYXRjaGVzID0gYXJyYXkoKTsKCmZvcmVhY2ggKCRzZW50ZW5jZXMgYXMgJHNlbnRlbmNlKQp7CgllY2hvICIkc2VudGVuY2UgLSAiOwoJJHJlc3VsdCA9IHByZWdfcmVwbGFjZSgkcmVnZXhwLCAi0LLQtdC70LjQutC+0LvQtdC/0L3Ri9C5INGH0LXQu9C+0LLQtdC6IiwgJHNlbnRlbmNlKTsKCWVjaG8gIiRyZXN1bHRcbiI7Cn0=