i want to filer a persian words in php
i want to replace خ
with خیابان
here my code but it dident work
its my code
preg_replace('/\bخ\b/'
,'خیابان'
,'خ جردن-بالاتر از اسفندیار-خ سعیدی-نبش مهرداد');
but my output is zero!!!!
i want to filer a persian words in php
i want to replace خ
with خیابان
here my code but it dident work
its my code
preg_replace('/\bخ\b/'
,'خیابان'
,'خ جردن-بالاتر از اسفندیار-خ سعیدی-نبش مهرداد');
but my output is zero!!!!
Basically you should use the unicode modifier in your regex:
<?php
$regex = '/\bخ\b/u';
$repl = 'خیابان';
$text = 'خ جردن-بالاتر از اسفندیار-خ سعیدی-نبش مهرداد';
echo preg_replace($regex, $repl , $text);