Require a php function that can generate a string array by input string.
eg:
input:abc[01-99]
return:abc01,abc02,abc03... abc99;
input:abc[1-99]
return:abc1,abc2,abc3...abc10...abc99
---
Any help is thankful.
Require PHP Code:Generate [01-99]
Moderator: General Moderators
-
Bennettman
- Forum Contributor
- Posts: 130
- Joined: Sat Jun 15, 2002 3:58 pm
It'd be possible to do this via range.
Basically, extract the stuff inside the brackets, split it, pop them into a range() to make an array, then loop through the new array to create your string. To get the double digit behaviour, you'd have to have it check the number of digits in the low number and use that to add extra 0s for single-digit numbers in the array.
Basically, extract the stuff inside the brackets, split it, pop them into a range() to make an array, then loop through the new array to create your string. To get the double digit behaviour, you'd have to have it check the number of digits in the low number and use that to add extra 0s for single-digit numbers in the array.
Thanks so much, that 's what I want.Bennettman wrote:It'd be possible to do this via range.
Basically, extract the stuff inside the brackets, split it, pop them into a range() to make an array, then loop through the new array to create your string. To get the double digit behaviour, you'd have to have it check the number of digits in the low number and use that to add extra 0s for single-digit numbers in the array.
