RE: [PHP] integer to string
| From: | Jennifer Goodie | Date: | Thu, 15 May 2003 21:38:48 +0000 |
| Subject: | RE: [PHP] integer to string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147825@lists.php.net to get a copy of this message | ||
> On Thu, 2003-05-15 at 17:19, Adam Voigt wrote:
> > $v = number_format($v,1);
>
> I ended up doing sprintf("%.1f", $v)
> Is that just as appropriate? Really was just the first thing I stumbled
> across in the manual that seemed to do what I wanted.
printf() would be more appropriate. sprintf() returns a string, printf()
prints a string, since you are echoing anyway, printf() makes sense.