Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

PHP Number Formats

Status
Not open for further replies.

AdminAdmin is verified member.

Administrator
Acorn Staff
Nominet Registrar
Joined
Jun 14, 2004
Posts
11,107
Reaction score
987
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.
General chit-chat
Help Users
  • No one is chatting at the moment.
      Helmuts @ HelmutsHelmuts is verified member.: Good morning all
      Top Bottom