Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function toFloat($string = null) {
- if($string) {
- preg_match_all("/[\d]+/", $string, $values);
- if(count($values[0]) > 1) {
- $value = (float)((int)implode($values[0]) / 100);
- } else {
- $value = (float)$values[0][0];
- }
- return $value;
- } else {
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement