I know this question has been replied many times here, but I still haven't got an exact answer.. I need to convert English letters to Persian/Arabic letters by some javascript, but not for the entire page, but only for a div or more. like only for a specific class.
I have come across these codes, but don't know which one are the best to use.
function convert($string) {
$persian = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹');
$num = range(0, 9);
return str_replace($persian, $num, $string);
}
I need exact that source to implement only on one div-class.
For example:
<div class="demo">12345</div>
should change to
<div class="demo">۱۲۳۴۵</div>