This article mainly introduces how PHP converts scientific notation to the original numeric string. It is a very practical technique to implement this function through a simple custom function using regular expression replacement, for more information, see
This article mainly introduces how PHP converts scientific notation to the original numeric string. It is a very practical technique to implement this function through a simple custom function using regular expression replacement, for more information, see
This article describes how PHP converts scientific notation to the original numeric string.
The specific implementation code is as follows:
The Code is as follows:
Function NumToStr ($ num ){
If (stripos ($ num, 'E') == false) return $ num;
$ Num = trim (preg_replace ('/[= \' "]/','', $ num, 1),' "'); // scientific notation is displayed, returns a string.
$ Result = "";
While ($ num> 0 ){
$ V = $ num-floor ($ num/10) * 10;
$ Num = floor ($ num/10 );
$ Result = $ v. $ result;
}
Return $ result;
}
I hope this article will help you with PHP programming.