Divide it by 10, cast as an integer to truncate the decimal and multiply back by 10:
$var = 44;
$roundvar = ((int) ($var/10)) * 10;
//$roundvar should equal 40
So fgets() returns the whole file in one go? If not then you have to manually add line breaks after each line fgets() gets like so:
<?php
$file = fopen("test.txt","r");
while(! feof($file))
{
echo fgets($file). "<br>";
}
fclose($file);
?>