I'm using this code:
$start = substr($string, 0, -6);
$end = substr($string, -6);
for($i = 0; $i < 500; $i++) {
if($end > 500) {
echo $start.$end--."<br />";
} else {
echo $start.$end++."<br />";
}
}
Where $string
will something like RXV123456
always last 6 characters will be a number.
If $string
is RXV123456
, the output will be someting like:
RXV123456
RXV123455
RXV123454
...
But, if $string
will be something like RXV012345
, I get this output:
RXV12345
RXV12344
RXV12343
Also if $string
will be RXV001234
or RXV000123
, same thing, that zeros will be omitted.
Any ideas how to keep the zeros if $end will start with one ore more zeros?