# trimming number in php



## aximbigfan (Jan 28, 2008)

Hi,

I made a log viewer in HP, and one part echoes the size in KB of the log file. I really don't care to know the extra numbers off the KB reading, I just want to know the number to the first place after the decimal point, for example 20.2.

The code that creates the reading just uses filsize() and divides that by 1024, and shoves that into a variable.

Any ideas?

chris


----------



## aximbigfan (Jan 28, 2008)

Sorry guys, I wasn't thinking, just use the round() function  ..


Chris


----------



## Disparia (Jan 28, 2008)

```
number_format($float, 1, '.', '');

round($float, 1);
```

Either will round to 1 decimal place.


----------

