Commas in Results

I am using the following script to display the number of
entries in a file:

<?PHP
echo count(file('filename.dat'));
?>

The current tally is in the 2500 range.

Is there any way to format it so that the comma is inserted
into the number (2,500) when the echo command sends it to the page?

Regards,



Fred
Fred Atkinson [ Sa, 24 März 2007 15:27 ] [ ID #1667701 ]

Re: Commas in Results

On Sat, 24 Mar 2007 10:27:44 -0400, Fred Atkinson
<fatkinson [at] mishmash.com> wrote:

> I am using the following script to display the number of
>entries in a file:
>
><?PHP
> echo count(file('filename.dat'));
>?>
>
> The current tally is in the 2500 range.
>
> Is there any way to format it so that the comma is inserted
>into the number (2,500) when the echo command sends it to the page?
>
> Regards,
>
>
>
> Fred

Disregard. I did some searching on the Internet. I came up
with this:

<?PHP
echo number_format(count(file('filename.dat')));
?>

It works fine.



Fred
Fred Atkinson [ Sa, 24 März 2007 15:37 ] [ ID #1667702 ]
PHP » alt.php » Commas in Results

Vorheriges Thema: PHP Consultants
Nächstes Thema: avast checks PHP files?