in reply to Testing whether a value is in a range.

kal,
You can most certainly test if ( 'SW1' >= $code && $code <= 'SW24' ).

But there are some things you want to keep in mind as the test is done ASCIIbetically.

  • Uppercase comes before lowercase
  • Numbers come before letters
  • Punctuation is mixed all over the place

    If you force all lower case and are sure that each character is the same type (either letter or number) in the corresponding value (low & high), then this method should work fine.

    Cheers - L~R

    Update: Clarified the final statement.