Level 73
Comma is , so you have no comma in your value. But you can cast the result to an int value:
$cents = (int) (2.99 * 100);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi everybody, I'm using Stripe to test making charges, Stripe API make charges in the smallest value posible (in this case it's cents), what I do is transform my original input (euros) to cents like this:
$cents = 2.99 * 100;
Now I want to remove the comma from the result with php, how can I do this?
Comma is , so you have no comma in your value. But you can cast the result to an int value:
$cents = (int) (2.99 * 100);
Please or to participate in this conversation.