One method left to solve the garbled problem. If there are four zeros, garbled characters may occur. For example, 0.01*0.00770000e-5 (garbled) should be equal to 0.00007. I don't know why php has such an error. Note: The original decimal point must be retained. Do not give away. How can this problem be solved? ------ Solution -------------------- 1. this is not garbled, it is scientific notation. 2. the round () function can specify the number of digits to the decimal point $ x.
If there are four zeros, garbled characters may occur.
For example, 0.01*0.007 = 7.0E-5 (garbled)
It should be 0.00007.
I don't know why php has such an error.
Note: The original decimal point must be retained. Do not give away. How can this problem be solved?
------ Solution --------------------
1. this is not garbled. it is a scientific notation.
2. the round () function can specify the digits of the decimal point.
$ X = 0.0000722;
$ S = round ($ x, 5 );
Echo $ s;
------ Solution --------------------
1. sprintf:
PHP code
------ Solution --------------------
PHP code
Echo bcmul (0.01, 0.007, 5); // 0.00007
------ Solution --------------------
Learned
------ Solution --------------------
Okay, it's disgusting.
$ S = 0.01*0.007;
Echo number_format ($ s, 5 ,'.','');
------ Solution --------------------
Discussion
$ S = number_format ($ x, 6 ,'.','');
The result is 0.000070.
How to remove the following 0 to 0.00007
------ Solution --------------------
Discussion
If there are four zeros, garbled characters may occur.
For example, 0.01*0.007 = 7.0E-5 (garbled)
It should be 0.00007.
I don't know why php has such an error.
Note: The original decimal point must be retained. Do not give away. How can this problem be solved?
------ Solution --------------------
Well. You can do this without adding 0:
PHP code