note 103097 modified in function.bcscale by danbrown

From: Date: Fri, 25 Mar 2011 15:52:24 +0000
Subject: note 103097 modified in function.bcscale by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-178209@lists.php.net to get a copy of this message
The general approach for a one liner trailing 0 removing would be : <?php echo rtrim('1.2500000000', '0.'); // 1.25 echo rtrim('1.00000000', '0.'); // 1 ?> Which seems totally appropriate since we are working with strings, and also is likely to be the fastest way. --was-- Another way to remove the unnecessary trialling zeros in one line : <?php echo rtrim('1.2500000000', '0'); // 1.25 ?> Which seems totally appropriate since we are working with strings, and also is likely to be the fastest way. http://php.net/manual/en/function.bcscale.php

« previous php.notes (#178209) next »