SHARE
TWEET

digit_e2b

a guest Aug 4th, 2011 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function digit_e2b($str)
  2. {
  3.  
  4.         $callback = create_function('$matches','
  5. if(preg_match("%&#\d+;%",$matches[0])) {
  6.                 return $matches[0];
  7.         }
  8.         $en_digit = array(1,2,3,4,5,6,7,8,9,0);
  9.         $bn_digit = array("১","২","৩","৪","৫","৬","৭","৮","৯","০");
  10.         return str_replace($en_digit, $bn_digit, $matches[0]);
  11. ');
  12.        
  13.         $converted = preg_replace_callback('%&#\d+;|[,\d]+%',$callback,$str);
  14.  
  15.         return $converted;
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top