I wrote below code but it works wrong:
$t = "۰۱۲۳۴۵۶۷۸۹٤٥٦";
$correct = array("0","1","2","3","4","5","6","7","8","9","4","5","6");
$wrong = array("٠","١","٢","٣","٤","٥","٦","٧","٨","٩","۴","۵","۶");
echo $t = str_replace($wrong,$correct, $t);
and the result isn't right
۰۱۲۳456۷۸۹۰۱۲۳456۷۸۹456
I search in stack and same questions and it's answers don't help me.
Use this code:-
$t = "۰۱۲۳٤٥٦";
$text = preg_replace(
array("٠","١","٢","٣","٤","٥","٦",),
array("0","1","2","3","4","5","6",),
$t );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With