Further it looks like the line could be rewritten like:
Code:
$captureAmt = (float)preg_replace("/[^0-9.]/", "", $_POST['captamt']);
That way, only the numbers entered would be involved, though if there was say a line of text entered with multiple numbers throughout, then they would basically get combined...
I'm still somewhat wondering if the above string should incorporate the decimal placeholder for the filtering instead of blindly applying the filter to keep only the decimal and not the comma if there is some system condition that would treat the float of the number differently in different currencies/system configurations...
I typically work in a comma separated thousands and decimal for parts of a whole system, so for me it requires a little more research to determine how other systems operate if different...
Bookmarks