I'm having trouble editing some PHP code that was written in a Perl style to get it to output in either comma or currency format.
The search in this forum led me to the PHP manual and the number_format command. I'm still having problems with the output.
The number being pulled from a MySQL database is 13085. It is the current value of the variable $revenue.
My goal is to get the output as either:
13,085.00 or $13,085.00
Current code:
$db->p("revenue");
this outputs 13085.00
I have attempted:
number_format($db->p("revenue"));
this outputs 13085.00
I then used a function:
<?php
function dollarformat($amount)
{
$amount=doubleval($amount);
echo(sprintf("%.2f", $amount));
}
?>
then
dollarformat($db->p("revenue"));
this outputs 13085.000.00
I'm having problems with the:
$db->p("revenue") in that I don't know what the "p" is doing.
How do I get 13,085.00? (with the comma)?