Advertisement
Guest User

digit_e2b revision 3

a guest
Aug 4th, 2011
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. function digit_e2b($str)
  2. {
  3.     $html_entity_regx = '&(#|\w+)\d+;';
  4.     $callback = create_function('$matches','
  5. if(preg_match("%' . $html_entity_regx . '%",$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('%' . $html_entity_regx . '|[,\d]+%',$callback,$str);
  14.  
  15.     return $converted;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement