note 27983 rejected from function.sprintf by nicos

From: Date: Sat, 28 Dec 2002 18:41:06 +0000
Subject: note 27983 rejected from function.sprintf by nicos
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-41387@lists.php.net to get a copy of this message
Note that the oh-so-useful g and e formats are missing from PHP's sprintf(). If you want "no more than three decimals", your best bet is to do the job with string functions: $v = ereg_replace("\\.0+\$|(\\.[^0]+)0+\$", "\\1", sprintf("%.3f", (float)$v));

« previous php.notes (#41387) next »