hlstriker Posted September 27, 2008 Share Posted September 27, 2008 I'm trying to format an integer so it always has 6 places. Example: 000006 000056 000456 003456 023456 123456 So if I had the number 12, how could I get PHP to add 4 zeros in front of the number so it would be 000012? Quote Link to comment https://forums.phpfreaks.com/topic/126096-solved-formatting-an-integer/ Share on other sites More sharing options...
AndyB Posted September 27, 2008 Share Posted September 27, 2008 http://ca.php.net/manual/en/function.str-pad.php Quote Link to comment https://forums.phpfreaks.com/topic/126096-solved-formatting-an-integer/#findComment-652037 Share on other sites More sharing options...
hlstriker Posted September 27, 2008 Author Share Posted September 27, 2008 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/126096-solved-formatting-an-integer/#findComment-652041 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.