/ Published in: PHP

ADD 0 to 1!
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /* Pad Numbers in PHP Sometimes I need numbers to always be two digits, even if they're less than 10. The below snippet will format all numbers to be two digits, inserting a 0 if they're under 10 - creating, for example, 09 instead of 9. */ $raw = 1; echo $formatted; //outputs 01 ?>
URL: http://www.bigbold.com/snippets/posts/show/2217
Comments
