I need help converting a string that contains a number in scientific notation to a normal string. Example strings: "9.1892E+11" to "918919850755"
Asked
Active
Viewed 80 times
-1
-
4As far as I understand: 9.1892E+11 = `918920000000` – Madhur Bhaiya Oct 27 '18 at 11:27
-
I used some predefined functions like : number_format, dechex etc. but not getting exact value. – Mohit Tiwari Oct 27 '18 at 11:28
-
@MadhurBhaiya thanks for quick response but number is 918919850755. Scientific string generated from csv cell. – Mohit Tiwari Oct 27 '18 at 11:29
-
@MadhurBhaiya Hope you understand. – Mohit Tiwari Oct 27 '18 at 11:41
1 Answers
1
PHP should understand the scientific notation. By substracting or adding 0 or something, it will change to a normal notation.
By doing this you might lose precision. You can cast the string to a float to prevent this.
$number = (float)$number;

DigiLive
- 1,093
- 1
- 11
- 28
-
-
-
-
-
The value displayes in the cell is excels visual representation of the value in the bar (and the cells actual value), but they're not the same. – DigiLive Oct 27 '18 at 11:58
-
-