i want to round $t 2e decimal to 0 or 5.
if $t= 1.31; //round to 1.30
if $t= 1.32 //round to 1.30
if $t= 1.33; //round to 1.35
if $t= 1.34; //round to 1
You can double the value so you can round to 1 decimal, then simple divide it by 2 again
$t = round(($t*2), 1) / 2;
try this one check the demo
0.05 * round($t * 20)
<?php
$ts= [1.31, 1.32, 1.33, 1.34, 1.35, 1.36, 1.37, 1.38, 1.39, 1.40];
array_walk($ts, function($t){echo number_format($t, 2)."\t".number_format(0.05*round($t*20), 2)."\n";});
output,
1.31 1.30
1.32 1.30
1.33 1.35
1.34 1.35
1.35 1.35
1.36 1.35
1.37 1.35
1.38 1.40
1.39 1.40
1.40 1.40