$n2 = str_pad($n + 1, 5, 0, STR_PAD_LEFT);
Use str_pad()
by adding 0
s (third parameter) to the left (fourth parameter) of the old number $n
incremented by 1
(first parameter) until the length is 5 (second parameter).
More Related Contents:
- Increment number php every next number
- php , I want to build array from 12 values each value has max number of 2048
- Show a number to two decimal places
- Formatting a number with leading zeros in PHP [duplicate]
- Why does PHP consider 0 to be equal to a string?
- How to mathematically evaluate a string like “2-1” to produce “1”?
- Is there an easy way to convert a number to a word in PHP?
- Why is PHP printing my number in scientific notation, when I specified it as .000021?
- Display numbers with ordinal suffix in PHP
- Test if number is odd or even
- Converting words to numbers in PHP
- Remove useless zero digits from decimals in PHP
- What is the best way to validate a credit card in PHP?
- Strange behaviour with numbers that have a leading zero [duplicate]
- PHP: Express Number in Words [duplicate]
- Round to max thousand, hundred etc in PHP
- PHP: Create an array for a range
- PHP prepend leading zero before single digit number, on-the-fly [duplicate]
- Max file number can php upload at same time
- php random x digit number
- PHP remove commas from numeric strings
- php: number only hash?
- Convert number into xx.xx million format? [closed]
- Date format using dd/mm/yyyy using HTML
- How verify if input is numeric
- How to Truncate a string in PHP to the word closest to a certain number of characters?
- How to get file URL using Storage facade in laravel 5?
- PHP to clean-up pasted Microsoft input
- Set cart item price from a hidden input field custom price in Woocommerce 3
- navigate back with PHP form submission