How to remove the excess zero after the decimal point by php
This article mainly explains "php how to remove the excess zero after the decimal point", the content of the explanation in the article is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "php how to remove the excess zero after the decimal point"!
1. Use "decimal + 0".
2. Use "floatval".
3. Use "rtrim (rtrim (decimal,'0'),'."
4. Use "preg_replace ('/ [.] $/', preg_replace ('/ 0 percent).
The regular expression states: / 0 echo preg_replace / remove the extra 0 / [.] $/ at the end. Echo preg_replace ('/ [.] $/',', preg_replace ('/ 0 million dollar,', '100.00'). "; echo preg_replace (' / [.] $/','', preg_replace ('/ 0 million))." Echo preg_replace ('/ [.] $/', preg_replace ('/ 0 million dollars,', '100.010203000')). "" Thank you for your reading. The above is the content of "how to remove the excess zeros after the decimal point in php". After the study of this article, I believe you have a deeper understanding of how php removes the excess zeros after the decimal point, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!