No matter what Bengali number I provide in $ben_num variable, it always outputs 1, like with 1111111111. Whatever the length of the $ben_num the output is the same length of ones (1s).
I tried to run the code in
It works perfectly fine in these sites. Output is whatever bengali number of strings I give (eg 1234567890).
Might PHP version be the problem?
$ben_num = "১২৩৪৫৬৭৮৯০";
bn2enNumber($ben_num);
function bn2enNumber ($number){
$search_array= array("১", "২", "৩", "৪", "৫", "৬", "৭", "৮", "৯", "০");
$replace_array= array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
$en_number = str_replace($search_array, $replace_array, $number);
echo $en_number;
}