Formatting a float as a percentage in PHP

To format a float value as a percentage in PHP:


$formatted = sprintf( '%.2f', $value * 100 );

Leave a Reply