Mateobus Posted April 23, 2006 Share Posted April 23, 2006 Hey i need some help, I want to convert some numbers so they all have a length of 4, by adding a certain number of preceeding zeros to them. so like 7 would print out as 0007, and 77 would print as 0077.Anyone know the code for this. Quote Link to comment Share on other sites More sharing options...
Barand Posted April 23, 2006 Share Posted April 23, 2006 [code]$num = 77;printf ('%04d', $num); // --> 0077[/code] Quote Link to comment 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.