Use the second parameter (precision) of the function round().
The code..
echo $fTemp." Fahrenheit is equal to ".round($cTemp,1)." Celsius<br />";
1which I used is an accuracy parameter and it will be rounded up to that ...
OUTPUT
0 Fahrenheit is equal to -17.6 Celsius
1 Fahrenheit is equal to -17.1 Celsius
2 Fahrenheit is equal to -16.5 Celsius
3 Fahrenheit is equal to -16 Celsius
4 Fahrenheit is equal to -15.4 Celsius
...... Goes on
source
share