Hi Ibrahim,
Sorry, I forgot about replacing '0'. :P
function replaceNumbers($str){
$str = str_replace("6" , '{six}' , $str );
$str = str_replace("0" , "٠" , $str );
$str = str_replace("1" , "١" , $str );
$str = str_replace("2" , "٢" , $str );
$str = str_replace("3" , "٣" , $str );
$str = str_replace("4" , "٤" , $str );
$str = str_replace("5" , "٥" , $str );
$str = str_replace("7" , "٧" , $str );
$str = str_replace("8" , "٨" , $str );
$str = str_replace("9" , "٩" , $str );
$str = str_replace("Wednesday" , "الأربعاء" , $str );
$str = str_replace("July" , "تموز" , $str );
$str = str_replace('{six}' , '٦' , $str );
return $str;
}
echo replaceNumbers("Wednesday, 07 July 2008");
2008/4/28 Ahmad Saleh <[EMAIL PROTECTED]>:
> function replaceNumbers($str){
> $str = str_replace("6" , "٦" , $str );
> $str = str_replace("0" , "٠" , $str );
> $str = str_replace("1" , "١" , $str );
> $str = str_replace("2" , "٢" , $str );
> $str = str_replace("3" , "٣" , $str );
> $str = str_replace("4" , "٤" , $str );
> $str = str_replace("5" , "٥" , $str );
> $str = str_replace("7" , "٧" , $str );
> $str = str_replace("8" , "٨" , $str );
> $str = str_replace("9" , "٩" , $str );
> $str = str_replace("Wednesday" , "الأربعاء" , $str );
> $str = str_replace("July" , "تموز" , $str );
> return $str;
> }
>
> echo replaceNumbers("Wednesday, 07 July 2008");
>
>
> Try this ;)
>
>
>
> 2008/4/28 Ibrahim Y <[EMAIL PROTECTED]>:
>
>> Hello all,
>>
>>
>> let's have this piece of code
>>
>> <?php
>>> function replaceNumbers($str){
>>> $str = str_replace("0" , "٠" , $str );
>>> $str = str_replace("1" , "١" , $str );
>>> $str = str_replace("2" , "٢" , $str );
>>> $str = str_replace("3" , "٣" , $str );
>>> $str = str_replace("4" , "٤" , $str );
>>> $str = str_replace("5" , "٥" , $str );
>>> *$str = str_replace("6" , "٦" , $str );*
>>> $str = str_replace("7" , "٧" , $str );
>>> $str = str_replace("8" , "٨" , $str );
>>> $str = str_replace("9" , "٩" , $str );
>>> $str = str_replace("Wednesday" , "الأربعاء" , $str );
>>> $str = str_replace("July" , "تموز" , $str );
>>> return $str;
>>> }
>>>
>>> echo replaceNumbers("Wednesday, 07 July 2008");
>>> ?>
>>>
>>
>> The output when invoking the function as follow:
>>
>> - when removing the line in Bold is ( الأربعاء, ٠٧ تموز ٢٠٠٨ ).
>> - when the line is there the output is (الأربعاء, �٦٦0;٧ تموز
>> �٦٦2;�٦٦0;�٦٦0;٨).
>>
>> what I want is to replace English numbers into Arabic(hindi) before I
>> display them on the page, is there any better way to replace numbers into
>> Arabic.
>>
>> Ibrahim
>>
>>
>> >>
>>
>
>
> --
> Ahmad Fathi Saleh
> http://ahmad.jopdc.com
--
Ahmad Fathi Saleh
http://ahmad.jopdc.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Jordan PHP Users Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/JoPHP
http://Jolug.org/
-~----------~----~----~----~------~----~------~--~---