How to change php decimal number to percent sign
This article mainly introduces the php decimal number how to turn the percent sign, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Php decimal sign to percent method: 1, to create a PHP sample file; 2, through the "round (5.055, 2);" to the decimal is rounded; 3, through the "$str."%; way to convert the decimal to the percentage.
This article operating environment: windows7 system, PHP7.1 version, Dell G3 computer.
How to change the php decimal to the percent sign?
PHP percent sign to decimal, php decimal conversion percentage function
PHP percent sign to decimal:
Php decimal conversion percentage function:
Function xx ($n) {return $n / 100.% salary;}
If there is a novel, the number of digits is required.
Sprintf (".2f", $nasty 100).'%'
Round it up before you convert it
$str=round (5.055, 2); / 5.06 $str1=$str. "%"; / 5.06% Thank you for reading this article carefully. I hope the article "how to change php decimal number to percent sign" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!