Hi,

I have a task to generate a new document number for a given range. This
document number is alphanumeric.

Here is the problem:

$lowrange1 = "900000";
$highrange1 = "HZZZZZ";

$currentno = "90CZZZ";

I expect that the next number in the series is:  $nextnum = "90D000";

Before using this next number in the series, I need to confirm that the
number falls within the given range.

So I do something like this:

if ((strval($nextnum) >= strval($lowrange1)) && (strval($nextnum) <=
strval($highrange1)))
{
    // we have a valid number in the range
}
else
{
    // not in the range
}

Now.. the problem is - PHP thinks that 90D000 is less than $lowrange1. I
individually tested them and $lowrange1 was consistently greater than the
number.

I put the strval function around each variable to ensure it was comparing
strings and not numbers for those variables that only contain numbers. This
seems to be a problem with the letter "D" and "E" for all positions within
the 6 character alphanumeric number, except for the last position.

ie. 900000D works - $lowrange1 is less than this number and $highrange1 is
greater than this number.

For all other positions where the letter "D" and "E" are generated:

ie. 9000D0, 900D00, 90D000, 9D0000 and 9000E0, 900E00, 90E000, 9E0000

Is there a known problem with this? Why it is only happening with the
letters "D" and "E"? If I have 900F00 - this works, and so on for the rest
of the letters of the alphabet.

Thanks,
Sam




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to