($val)
| 799 | } |
| 800 | |
| 801 | private function floatvalue($val) |
| 802 | { |
| 803 | // if value is a 3 digit comma number with one leading zero like 0,111, it should not go through the 1000 separator removal |
| 804 | if (preg_match('/(?<=\b0)\,(?=\d{3}\b)/', $val) === 0 && preg_match('/(?<=\b0)\.(?=\d{3}\b)/', $val) === 0) { |
| 805 | // remove , as 1000 separator |
| 806 | $val = preg_replace('/(?<=\d)\,(?=\d{3}\b)/', '', $val); |
| 807 | // remove . as 1000 separator |
| 808 | $val = preg_replace('/(?<=\d)\.(?=\d{3}\b)/', '', $val); |
| 809 | } |
| 810 | // convert remaining comma to decimal point |
| 811 | $val = str_replace(",", ".", $val); |
| 812 | if (is_numeric($val)) { |
| 813 | return number_format(floatval($val), 2, '.', ''); |
| 814 | } else { |
| 815 | return false; |
| 816 | } |
| 817 | } |
| 818 | |
| 819 | } |
no outgoing calls
no test coverage detected