• Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

PHP Number Formats

Status
Not open for further replies.

AdminAdmin is verified member.

Administrator
Acorn Staff
Acorn Moderator
Developer
Server Admin
Nominet Registrar
Joined
Jun 14, 2004
Posts
11,191
Reaction score
1,059
I am trying to format a number being read for a MySQL DB into a PHP page.

My field in the DB is set as decimal (50,0)
My code in my PHP is:
PHP:
<td class="cat">£{$data|number_format}</td>

The output is 4,500.00

How do I change this to drop the decimals i.e. 4,500 ??

Thanks

Admin
 
PHP:
{$data|number_format}

That isn't strictly PHP. It's part of the template parser. However, not sure which one. Could be smarty, which if it is try this:

PHP:
{$data|number_format:0}
 
Status
Not open for further replies.
Top Bottom