Hi Iskandaer,
what is the benefit to use your code over mine? assuming both are working
without any problem.

Ibrahim

2008/4/28 alex. asknat <[EMAIL PROTECTED]>:

> you can use this too ....
>
>
>  <?php
>  function replaceNumbers($str){
>   $chars = array();
>
>  $chars=str_split($str);
>  foreach ($chars as &$keys)
>  {
>   switch ($keys)
>   {
>    case 0 : $keys = str_replace("0" , "&#x0660;" , $keys );
>    break ;
>    case 1 :  $keys = str_replace("1" , "&#x0661;" , $keys );
>    break ;
>    case 2 :  $keys = str_replace("2" , "&#x0662;" , $keys );
>    break ;
>    case 3 :   $keys = str_replace("3" , "&#x0663;" ,  $keys );
>    break ;
>    case 4 :   $keys = str_replace("4" , "&#x0664;" ,  $keys );
>    break ;
>    case 5 : $keys = str_replace("5" , "&#x0665;" ,  $keys );
>    break ;
>    case 6 :   $keys = str_replace("6" , "&#x0666;" ,  $keys );
>    break ;
>    case 7 :   $keys = str_replace("7" , "&#x0667;" ,  $keys );
>    break ;
>    case 8 :  $keys = str_replace("8" , "&#x0668;" ,  $keys );
>    break ;
>    case 9 :   $keys = str_replace("9" , "&#x0669;" ,  $keys );
>    break ;
>
>
>   }
>  }
>
> // $str = str_replace("0" , "&#x0660;" , $str );
> // $str = str_replace("1" , "&#x0661;" , $str );
> // $str = str_replace("2" , "&#x0662;" , $str );
> // $str = str_replace("3" , "&#x0663;" , $str );
> // $str = str_replace("4" , "&#x0664;" , $str );
> // $str = str_replace("5" , "&#x0665;" , $str );
> // $str = str_replace("6" , "&#x0666;" , $str );
> // $str = str_replace("7" , "&#x0667;" , $str );
> // $str = str_replace("8" , "&#x0668;" , $str );
> // $str = str_replace("9" , "&#x0669;" , $str );
>  $str=implode('', $chars);
> $str = str_replace("Wednesday" , "الأربعاء" , $str );
>  $str = str_replace("July" , "تموز" , $str );
>
>  return $str;
>  }
>  echo replaceNumbers("Wednesday, 07 July 2008");
>  ?>
>
> the output is الأربعاء, ٠٧ تموز ٢٠٠٨
>
> Iskandar m .
>
>
>
> but am still junior :)
>
>
>
>
>
> ------------------------------
> Date: Mon, 28 Apr 2008 16:18:54 +0300
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: [JoPHP] Re: what is the problem with this code
>
> here is it
>
>  function replaceNumbers($str){
>     $arNum = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
>     $inNum = array("&#x0660;", "&#x0661;", "&#x0662;", "&#x0663;",
> "&#x0664;", "&#x0665;", "&#x0666;", "&#x0667;", "&#x0668;", "&#x0669;");
>     return str_replace($arNum, $inNum, $str);
> }
>
> echo replaceNumbers("Wednesday, 07 July 2008");
>
>
>
>
>
>
>
> On Mon, Apr 28, 2008 at 3:54 PM, Ammar Ibrahim <[EMAIL PROTECTED]>
> wrote:
>
> can you show me the function, and how you called it?
>
> On Mon, Apr 28, 2008 at 3:52 PM, Ibrahim Y <[EMAIL PROTECTED]> wrote:
> > Hi Ammar,
> > I used the first function, it has the same bug, the output using same
> string
> > was ( Wednesday, �٦٦0;٧ July �٦٦2;�٦٦0;�٦٦0;٨ ).
> >
> > Ibrahim
> >
> >
> >
> >
> > On Mon, Apr 28, 2008 at 3:06 PM, Ammar Ibrahim <[EMAIL PROTECTED]>
> > wrote:
> >
> > >
> > > This is complicated, and it uses regex, and it will be very slow. Why
> > > don't you use the code I sent? use the first function
> > >
> > >
> > >
> > >
> > > On Mon, Apr 28, 2008 at 3:01 PM, Ibrahim Y <[EMAIL PROTECTED]> wrote:
> > > > thanks all
> > > > oh, I got it, why the problem was only with number '6', I think I
> was
> > sleepy
> > > > :P
> > > >
> > > > the code was written in that way for tracing issues, anyway, I fixed
> the
> > > > problem by adding '^' to the string before replacing it, check it
> below
> > > > please
> > > >
> > > > > function replaceNumbers($str){
> > > > >     $str = preg_replace('/([0-9])/','^\1^',$str);
> > > > >     $enNum = array("^0^", "^1^", "^2^", "^3^", "^4^", "^5^",
> "^6^",
> > "^7^",
> > > > "^8^", "^9^");
> > > > >     $arNum = array("&#x0660;", "&#x0661;", "&#x0662;", "&#x0663;",
> > > > "&#x0664;", "&#x0665;", "&#x0666;", "&#x0667;", "&#x0668;",
> "&#x0669;");
> > > > >     $str = str_replace($enNum, $arNum, $str);
> > > > >     return $str;
> > > > > }
> > > > >
> > > > this will fix the problem, any comment?
> > > >
> > > >
> > > >
> > > >  >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >  >
> >
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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/
-~----------~----~----~----~------~----~------~--~---

Reply via email to