Posted by Kim Andrι Akerψ on 09/07/06 09:12
deko wrote:
> contents of myfile.txt = 5035|9638742|11938 // (one line of text)
>
> $myfile = "/home/path/public_html/myfile.txt";
> $totals = file($myfile);
> $var = explode("|", $totals[0]);
> $i = number_format($var[0]);
> $k = number_format($var[1]);
>
> For some reason this is acting funny. I am getting a null value for
> $k for some reason...
>
> Is there a better way to do this?
>
> Thanks in advance.
The number_format() function accepts the given number as a float, but
you're passing a string as the number. What happens if you rather do
the last 2 lines like this?
$i = number_format(floatval($var[0]));
$k = number_format(floatval($var[1]));
--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
[Back to original message]
|