($val)
| 596 | } |
| 597 | |
| 598 | private function floatvalue($val) |
| 599 | { |
| 600 | // if value is a 3 digit comma number with one leading zero like 0,111, it should not go through the 1000 separator removal |
| 601 | if (preg_match('/(?<=\b0)\,(?=\d{3}\b)/', $val) === 0 && preg_match('/(?<=\b0)\.(?=\d{3}\b)/', $val) === 0) { |
| 602 | // remove , as 1000 separator |
| 603 | $val = preg_replace('/(?<=\d)\,(?=\d{3}\b)/', '', $val); |
| 604 | // remove . as 1000 separator |
| 605 | $val = preg_replace('/(?<=\d)\.(?=\d{3}\b)/', '', $val); |
| 606 | } |
| 607 | // convert remaining comma to decimal point |
| 608 | $val = str_replace(",", ".", $val); |
| 609 | if (is_numeric($val)) { |
| 610 | return number_format(floatval($val), 2, '.', ''); |
| 611 | } else { |
| 612 | return false; |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | } |
no outgoing calls
no test coverage detected