lets say i have
$num1 = 0;
$num2 = 1.00;
$num3 = 1.2;

is there a php function that will convert int or double/float to usa dollar currency?
so the output should be
$num1 => 0.00;
$num2 => 1.00; //note this will stay same
$num3 => 1.20;

i found this function on google

setlocale(LC_MONETARY, 'en_US');
money_format($num3);

but it say its a "Call to undefined function money_format()"

According to the PHP docs, money_format is unsupported on Windows environments. Are you running Windows?

As an alternative, you could try number_format.

number_format(0, 2);    // 0.00
number_format(1.00, 2); // 1.00
number_format(1.2, 2);  // 1.20
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.