Hey i just want to know how to remove the decimal point in a number. The format i need to send must include the trailing zeros but one api wants it with the decimal point and the other is fussy and wants it without.
I already happily send values like 7.99 and 19.99 to the main api but i've been asked to implement another api that requires the same values in a format like 799 and 1999
You could just multiply it by 100.
$withoutDecimal = round($withDecimal * 100);
The round() is there mainly to protect against floating point arithmetic inaccuracies, but also protects against any case where there are more than 2 decimal digits.
If your numbers are stored as strings, you could simply remove the dot.
$num = '10.00'; $num = str_replace('.', '', $num); echo $num;