php - How could i show only one digit after floating point -


$f = sprintf ("%.1f",$per); echo "you hit".$f." 

by code can show 1 digit after floating point.but when result 100%,then shows 100.0%. want show 100%. how this????

$per = 100; $f = sprintf ("%.1f",$per); $rounded = round($f, 1); echo $rounded; 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -