From 7bc23e68b1a6330ee7f27775a147e07db349eb34 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 24 Sep 2021 20:55:21 +1000 Subject: [PATCH] FIxes for parsing string floats --- app/Utils/Number.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Utils/Number.php b/app/Utils/Number.php index 2a284d6279..8e956a7bf6 100644 --- a/app/Utils/Number.php +++ b/app/Utils/Number.php @@ -61,12 +61,12 @@ class Number // convert "," to "." $s = str_replace(',', '.', $value); - if($value < 1) - return (float)$s; - // remove everything except numbers and dot "." $s = preg_replace("/[^0-9\.]/", '', $s); + if($s < 1) + return (float)$s; + // remove all seperators from first part and keep the end $s = str_replace('.', '', substr($s, 0, -3)).substr($s, -3);