($val)
| 781 | } |
| 782 | |
| 783 | private function floatvalue($val) |
| 784 | { |
| 785 | // if value is a 3 digit comma number with one leading zero like 0,111, it should not go through the 1000 separator removal |
| 786 | if (preg_match('/(?<=\b0)\,(?=\d{3}\b)/', $val) === 0 && preg_match('/(?<=\b0)\.(?=\d{3}\b)/', $val) === 0) { |
| 787 | // remove , as 1000 separator |
| 788 | $val = preg_replace('/(?<=\d)\,(?=\d{3}\b)/', '', $val); |
| 789 | // remove . as 1000 separator |
| 790 | $val = preg_replace('/(?<=\d)\.(?=\d{3}\b)/', '', $val); |
| 791 | } |
| 792 | // convert remaining comma to decimal point |
| 793 | $val = str_replace(",", ".", $val); |
| 794 | if (is_numeric($val)) { |
| 795 | return number_format(floatval($val), 2, '.', ''); |
| 796 | } else { |
| 797 | return false; |
| 798 | } |
| 799 | } |
| 800 | |
| 801 | } |
no outgoing calls
no test coverage detected