RE: [PHP] echo vs printf
| From: | Don Read | Date: | Mon, 16 Jul 2001 15:43:39 +0000 |
| Subject: | RE: [PHP] echo vs printf | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58064@lists.php.net to get a copy of this message | ||
On 16-Jul-01 brother wrote:
> Why should I use printf instead of echo and vice versa?
>
printf print-formated
$a=12.3456;
echo $a, '<BR>';
printf('%1.2f<BR>', $a);
12.3456<BR>
12.34<BR>
> As for today I use printf mostly but I don't know why.
You prolly mean print; There may be some minor differences from echo,
but i've never seen 'em.
(i think they threw print in PHP to keep JAPHs happy).
Regards,
--
Don Read dread@texas.net
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.