Revision: 11189
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 27, 2009 15:36 by xtheonex
Initial Code
<?php printf('%02.2f', $number); ?>
Initial URL
Initial Description
I use this snippet to force a number to 2 decimal places. Eg, For prices, PHP rounds the number 22.20 to 22.2. This code forces a zero on the end if there isn't 2 decimal places already.
Initial Title
Returns a number forced to 2 decimal places.
Initial Tags
php
Initial Language
PHP