PHP , Help... Need to use only 2 decimals

Hi all

Would like to ask for help with how to format value into only 2 decimal numbers.

<td><?=formatter($netchainPrice->netchain->usd_market_cap) ?></td>
...

This gives me output : $4,566.7718 ...(But I want to use just $4,566.77)

Hello!

Take a look at money_format :slight_smile::

setlocale(LC_MONETARY, 'en_US');
$out = money_format('%n', '4566.7718');

echo $out;
// Output: $4,566.77
1 Like