PHP function to convert numbers mode

a guest Jul 22nd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function changeNumbers($str,$mode='en',$mf='٫'){
  3.  $latin=array('0','1','2','3','4','5','6','7','8','9','.');
  4.  $farsi=array('۰','۱','۲','۳','۴','۵','۶','۷','۸','۹',$mf);
  5.  return($mode=='fa')?str_replace($latin,$farsi,$str):str_replace($farsi,$latin,$str);
  6. }
  7. ?>
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