Hi guys,
I have a csv file that looks like this:
name, nr, nr, nr, nr
Now the last two numbers are big, like 100.000+ and they appear in the csv without being formatted.
So when I output them to a html table, I load them into an array:
$row = 1;
$fp = fopen ("temp/allianceinfo.txt","r");
while ($data = fgetcsv ($fp, 1000, ",")) {
$num = count ($data);
print "<TR>";
$row++;
Now I use the number_format() command to place comma's in the numbers to make them readable:
for ($c=0; $c<$num; $c++) {
$data[$c]= number_format ($data[$c], ",");
print"$data[$c]";
}
This works perfectly except that the number_format messes up the name and turns it into a 0. So now instead of getting a table that is
name | nr | nr | nr | nr |
It get
0 | nr | nr | nr | nr |
I was thinking I could use an if statement that only runs $data[$c] through number_format() if it's a number but I don't know how to do that and I couldn't find it anywhere.
Thanks in advance