Welcome to the Cookbook

loading...

7.6.3 toPercentage

Er is geen nog vertaling vertaling voor deze rubriek. Help ons en vertaal dit.. Meer informatie over vertalingen

toPercentage(mixed $number, int $precision = 2)

Like precision(), this method formats a number according to the supplied precision (where numbers are rounded to meet the given precision). This method also expresses the number as a percentage and prepends the output with a percent sign.

<?php echo $number->toPercentage(45.691873645); ?>
 
//Outputs: 
45.69%
  1. <?php echo $number->toPercentage(45.691873645); ?>
  2. //Outputs:
  3. 45.69%