Wednesday, May 23, 2012

show 1 insted of 01 with PHP pack for Persian numbers

there is a function for converting English standard nums to Persian (Farsi) or Arabic nums:




function farsinum($str){ if (strlen($str) == 1){
$str = "0".$str; $out = ""; for ($i = 0; $i < strlen($str); ++$i) {
$c = substr($str, $i, 1);
$out .= pack("C*", 0xDB, 0xB0 + $c); } } return $out; }




but this function produce 01 02 03 ... insted of 1 2 3 ...
i think something must be change here:




$out .= pack("C*", 0xDB, 0xB0 + $c);




any help appreciated.





No comments:

Post a Comment