Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement