Arkadaşlar merhaba aşağıdaki kod olmayan veya yanlış olan harfi bold yapması gerekli fakat preg replace den umduğum bir hata mevcut kodla ilgili yardımcı olacak arkadaşlar varsa çok sevinirim
PHP:
function diff($old, $new) {
$old = trim($old);
$new = trim($new);
$result = $old;
$length = strlen($old);
for($i = 0; $i < $length; $i++) {
$konum = strripos($old[$i], $new[$i]);
if($konum) {
}
else
{
$new = preg_replace ("#".$old[$i]."#si", "<b>".$old[$i]."</b>",$new);
}
}
return $new;
}
$string1 = "Hello World!! Please review my diff function. Be gentle.";
$string2 = "rello world! Please critique dirff function. Be extra vigilant.";
echo diff($string1, $string2);