Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

PHP Number Formats

Status
Not open for further replies.

Admin

Administrator
Staff member
Joined
Jun 14, 2004
Posts
11,076
Reaction score
962
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}
 
No problems. Smarty is v good - we use it for quite a few clients.

Smarty might be worth reading :)
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

No members online now.

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom