[PHP] Re: Comparing Alphanumeric values in a range

2002-09-22 Thread Samantha Savvakis

Just quickly, forgot to mention:

I've tested this on 2 platforms:

Windows PHP 4.2.1
SCO Openserver 4.2.1

These two both don't work.

I just tested on SCO OpenUnix 4.2.1 - this one works!! Problem is, I need
this to work on SCO Openserver.

Thanks,
Sam

Samantha Savvakis [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 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 = 90;
 $highrange1 = HZ;

 $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. 90D 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, 9D and 9000E0, 900E00, 90E000, 9E

 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




[PHP] Re: Comparing Alphanumeric values in a range

2002-09-22 Thread Samantha Savvakis

Er..no, isn't working on OpenUnix.

90DZZZ - this should be 90E000 after the increment.

This isn't working on any platform using PHP 4.2.1



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