Last Updated: February 20, 2016
· thebrainroom

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'])); ?>