RE: [PHP] Fw: Print float with varying format???

From: Date: Fri, 28 Sep 2001 13:27:19 +0000
Subject: RE: [PHP] Fw: Print float with varying format???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-69174@lists.php.net to get a copy of this message
$a = "1.0000"; $b = "1.5000"; $c = "1.2500"; $d = "1.6667"; settype($a,"double"); settype($b,"double"); settype($c,"double"); settype($d,"double"); -----Original Message----- From: Keith [mailto:kaparsons24@nospam-hotmail.com] Sent: Friday, 28 September 2001 10:27 PM To: php-general@lists.php.net Subject: [PHP] Fw: Print float with varying format??? Hello, I would like to display a float to a precision of 2 but not if the trailing values are 0. Ex: 1.0000 should display '1' 1.5000 should display '1.5' 1.2500 should display '1.25' 1.6667 should display '1.67' Is their any display functions that would allow this? I know that I can display fixed precision of 2 but I don't want the trailing numbers! Thanks, Keith kaparsons24@nospam.hotmail.com Please remove nospam to send mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#69174) next »