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. Link to comment https://forums.phpfreaks.com/topic/8188-printf-help/ 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] Link to comment https://forums.phpfreaks.com/topic/8188-printf-help/#findComment-29872 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.