I need a suggestion on a function for a php counter. Is there any function to have numbers with 5 digit as 00001, or 00123… this number should be not random but have to increase the value of a previous field.
If a number is $n=’00001’ there is a function to increase by one and get 00002 and not 2?
Thanks
F.
Use
str_pad()by adding0s (third parameter) to the left (fourth parameter) of the old number$nincremented by1(first parameter) until the length is 5 (second parameter).