Dysan Posted December 14, 2007 Share Posted December 14, 2007 How do I format a number field to display 000001 instead of just 1? Link to comment https://forums.phpfreaks.com/topic/81610-format-number/ Share on other sites More sharing options...
Northern Flame Posted December 14, 2007 Share Posted December 14, 2007 what exactly do you plan to use the number for? and how will you get this number (post data, pre-defined, etc) there are ways to do this, but it depends on certain information Link to comment https://forums.phpfreaks.com/topic/81610-format-number/#findComment-414544 Share on other sites More sharing options...
kenrbnsn Posted December 14, 2007 Share Posted December 14, 2007 I would use the sprintf() function: <?php $num = 1; echo sprintf("%06d",$num) . "<br>\n"; ?> Ken Link to comment https://forums.phpfreaks.com/topic/81610-format-number/#findComment-414575 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.