SyntaxFix
Write A Post
Hire A Developer
Questions
Ultimate Solution: The only safe way is to use regex:
echo preg_replace("/\.?0+$/", "", 3.0); // 3 echo preg_replace("/\d+\.?\d*(\.?0+)/", "", 3.0); // 3
it will work for any case