SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. function toFloat($string = null) {
  3.     if($string) {
  4.         preg_match_all("/[\d]+/", $string, $values);
  5.         if(count($values[0]) > 1) {
  6.             $value = (float)((int)implode($values[0]) / 100);
  7.         } else {
  8.             $value = (float)$values[0][0];
  9.         }
  10.         return $value;
  11.     } else {
  12.         return 0;
  13.     }
  14. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top