IIM NUR DIANSYAH
IIM NUR DIANSYAH

Reputation: 432

how to change long format number in php?

I want to ask something about number function on PHP. How to change 1.7849313424115E+16 format into 17849313424115340 ?

My problem is, i use an API and return value is 1.7849313424115E+16, but i need 17849313424115340 format for another process. i can't change API for output code, so i think i must "convert" the output value. Is it possible to do?

I've tried to use round(), intval(), etc. but i still not get a clue.Any ideas or suggest? Any help would be appreciate.

Thanks in advance :)

Upvotes: 0

Views: 147

Answers (2)

Harendra Singh
Harendra Singh

Reputation: 203

You can simply use number_format function in PHP.

echo number_format(1.7849313424115E+16);

It returns the following output:

17,849,313,424,115,000

Upvotes: 3

Chonchol Mahmud
Chonchol Mahmud

Reputation: 2735

You can use number_format function for this.

  number_format(1.7849313424115E+16,0,'','')

Upvotes: 4

Related Questions