How to display two decimals in MYSQL/PHP?

double, mysql, php

Solution

Try this:

echo number_format ($price, 2);

Problem

I'd like to display £2.00 instead of £2 or £3.50 instead of £3.5. These number let's say `price` is defined as `DOUBLE` in a MySQL database. How can I force MySQL or PHP to display the two decimals? Many thanks!

Original source