RE: [PHP] integer to string
| From: | Jennifer Goodie | Date: | Thu, 15 May 2003 21:25:32 +0000 |
| Subject: | RE: [PHP] integer to string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147820@lists.php.net to get a copy of this message | ||
> foreach($p_val as $v) {
> printf("%.1f\n", $v);
> }
> -----Original Message-----
> From: Brian V Bonini [mailto:b-bonini@cox.net]
> Sent: Thursday, May 15, 2003 7:28 AM
> To: PHP Lists
> Subject: [PHP] integer to string
>
>
> I have this:
>
> for($i = 1; $1 <= 2.1; $i += 0.1) {
> $p_val[] = $i;
> }
>
> foreach($p_val as $v) {
> echo $v . "\n";
> }
>
> which returns:
>
> 1
> 1.1
> 1.2
> 1.3
> 1.4
> 1.5
> 1.6
> 1.7
> 1.8
> 1.9
> 2
>
> how to I get it so that 1 & 2 are 1.0 & 2.0
>
> ??
>
> Thanks!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>