Here's a short function:
function convert($string) {
$persian = ['?', '?', '?', '?', '?', '?', '?', '?', '?', '?'];
$arabic = ['?', '?', '?', '?', '?', '?', '?', '?', '?','?'];
$num = range(0, 9);
$convertedPersianNums = str_replace($persian, $num, $string);
$englishNumbersOnly = str_replace($arabic, $num, $convertedPersianNums);
return $englishNumbersOnly;
}
You can use the unicode instead of the characters in $persian
(I think).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…