[PHP] Percentages
Hi, Working on a site that needs some billing information. Once upon a time done in ASP where we had the option to use the FormatPercent command - is there an equivalent command within PHP? Using PHP 3.0.16 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Percentages
Working on a site that needs some billing information. Once upon a time done in ASP where we had the option to use the FormatPercent command - is there an equivalent command within PHP? Couldn't you just use number_format() and stick a % sign in there yourself? -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Percentages
On Mon, 25 Jun 2001 12:04, Tim Thorburn wrote: Hi, Working on a site that needs some billing information. Once upon a time done in ASP where we had the option to use the FormatPercent command - is there an equivalent command within PHP? Using PHP 3.0.16 Stab in the dark as I dunno exactly what FormatPercent does - number_format, printf or sprintf. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA What this country needs is a good five-cent microcomputer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Percentages
On Sun, 24 Jun 2001, David Robley wrote: On Mon, 25 Jun 2001 12:04, Tim Thorburn wrote: Hi, Working on a site that needs some billing information. Once upon a time done in ASP where we had the option to use the FormatPercent command - is there an equivalent command within PHP? Using PHP 3.0.16 Stab in the dark as I dunno exactly what FormatPercent does - number_format, printf or sprintf. Takes a decimal number and formats it as a percentage. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Percentages
How 'bout using this hack: function formatPercent ($decimal, $round = 2) { return round($decimal*100, $round).'%'; } --Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]