[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: arabic numbering in php?



glad i could help :)


i'm not a php geek, just wondering what was the purpose or what you wanted to use it for?


tried it and it only prints ١


ahmed at piousity dot net wrote:
cool, that worked, jazakAllah khair.  for the purpose of sharing,
here's what i did:

<?php
   function arabize($num){
      $start = strlen('' . $num);
      $val = pow(10, $start-1);

      $result = "";
      while ($val > 1){
         $result = $result . arabizeDigit((int)($num / $val));
         $num = $num % $val;
         $val = $val / 10;
      }
      $result = $result . arabizeDigit($num);
      return $result;
   }

   function arabizeDigit($num){
      $val = 660 + $num;
      return "&#x$val;";
   }


   echo arabize(1);
?>

  

_______________________________________________ Developer mailing list Developer at arabeyes dot org http://lists.arabeyes.org/mailman/listinfo/developer