How can i replace the cyrilian sign Ѓ
with a <br />
?
This one doesn't work:
$card = str_replace('Ѓ ', '<br />', $card);
This one doesn't work either:
$card = str_replace( array('ѓ', 'Ѓ'),'<br />', $card )
How can i replace the cyrilian sign Ѓ
with a <br />
?
This one doesn't work:
$card = str_replace('Ѓ ', '<br />', $card);
This one doesn't work either:
$card = str_replace( array('ѓ', 'Ѓ'),'<br />', $card )
Just few minutes ago searched for same function and found one from PHP.net comments that works for me.
Try this.
function mb_str_replace($needle, $replacement, $haystack) {
$needle_len = mb_strlen($needle);
$replacement_len = mb_strlen($replacement);
$pos = mb_strpos($haystack, $needle);
while ($pos !== false)
{
$haystack = mb_substr($haystack, 0, $pos) . $replacement
. mb_substr($haystack, $pos + $needle_len);
$pos = mb_strpos($haystack, $needle, $pos + $replacement_len);
}
return $haystack;
}
This code works (see http://ideone.com/hE72xA):
<?php
$card = "Hello Ѓ";
echo str_replace("Ѓ","<br/>",$card);
?>
output:
Hello <br/>