Insert leading zeros

From: Date: Wed, 16 Jul 2003 00:36:21 +0000
Subject: Insert leading zeros
Groups: php.general 
Request: Send a blank email to php-general+get-155349@lists.php.net to get a copy of this message
I have a string of digits that looks like something like these: 0025, 1234, 0001, 1003, and so on. They are all 4 digits in length. Then when I increment one of them by 1, I want to still have 4 digits for the value (it should insert the leading zeros if needed). Is there any type of function that will force the incremented value to be exactly 4 digits no matter what number it increments? Please let me know if there is a function that will insert these leading zeros or truncate it to 4 digits if necessary. Thanks. Matt

« previous php.general (#155349) next »