Changing the number format of a field in Drupal 7
When printing raw data from a node you may need to insert a decimal place to split a number up. For example, a value of 12000 is printed out but you want 12,000. You can use number_format to do this:
<?php print (number_format($node->field_number['und'][0]['value'])); ?>
Written by Tom
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#