continental state function

Hi,

Using PHP 4.4.4. Does anyone have a pre-written function that tests
whether a two letter abbreviation is in the continental United
States? At first I wrote my function to check against inequality with
"AK" and "HI", but that neglects the territories and protectorates,
and some people will enter those in as abbreviations (e.g. "VI",
Virgin Islands) in our shopping cart.

Thanks, - Dave
laredotornado [ Mo, 19 März 2007 23:41 ] [ ID #1662098 ]

Re: continental state function

<laredotornado [at] zipmail.com> wrote in message
news:1174344110.918327.309280 [at] n59g2000hsh.googlegroups.com.. .
| Hi,
|
| Using PHP 4.4.4. Does anyone have a pre-written function that tests
| whether a two letter abbreviation is in the continental United
| States? At first I wrote my function to check against inequality with
| "AK" and "HI", but that neglects the territories and protectorates,
| and some people will enter those in as abbreviations (e.g. "VI",
| Virgin Islands) in our shopping cart.

this function is quite easy to understand:

function isState($abbreviation)
{
$states = array(
'AL' ,
'AK' ,
'AZ'
// and so on ...
);
return in_array($abbreviation, $states);
}
Steve [ Di, 20 März 2007 04:29 ] [ ID #1663201 ]

Re: continental state function

On Mar 19, 10:29 pm, "Steve" <no.... [at] example.com> wrote:
> <laredotorn... [at] zipmail.com> wrote in message
>
> news:1174344110.918327.309280 [at] n59g2000hsh.googlegroups.com.. .
> | Hi,
> |
> | Using PHP 4.4.4. Does anyone have a pre-written function that tests
> | whether a two letter abbreviation is in the continental United
> | States? At first I wrote my function to check against inequality with
> | "AK" and "HI", but that neglects the territories and protectorates,
> | and some people will enter those in as abbreviations (e.g. "VI",
> | Virgin Islands) in our shopping cart.
>
> this function is quite easy to understand:
>
> function isState($abbreviation)
> {
> $states = array(
> 'AL' ,
> 'AK' ,
> 'AZ'
> // and so on ...
> );
> return in_array($abbreviation, $states);
>
> }

Thanks but what I was selfishly hoping was that someone could list
those out. It is a pain to cut and paste and type. - Dave
laredotornado [ Mi, 21 März 2007 23:21 ] [ ID #1664372 ]

Re: continental state function

<laredotornado [at] zipmail.com> wrote in message
news:1174515661.880771.84030 [at] l75g2000hse.googlegroups.com...
| On Mar 19, 10:29 pm, "Steve" <no.... [at] example.com> wrote:
| > <laredotorn... [at] zipmail.com> wrote in message
| >
| > news:1174344110.918327.309280 [at] n59g2000hsh.googlegroups.com.. .
| > | Hi,
| > |
| > | Using PHP 4.4.4. Does anyone have a pre-written function that tests
| > | whether a two letter abbreviation is in the continental United
| > | States? At first I wrote my function to check against inequality with
| > | "AK" and "HI", but that neglects the territories and protectorates,
| > | and some people will enter those in as abbreviations (e.g. "VI",
| > | Virgin Islands) in our shopping cart.
| >
| > this function is quite easy to understand:
| >
| > function isState($abbreviation)
| > {
| > $states = array(
| > 'AL' ,
| > 'AK' ,
| > 'AZ'
| > // and so on ...
| > );
| > return in_array($abbreviation, $states);
| >
| > }
|
| Thanks but what I was selfishly hoping was that someone could list
| those out. It is a pain to cut and paste and type. - Dave

jesus christ!

google, get the list, paste it into an editor that allows columnar editing
(ctrl+c in crimson editor), format it, and you're good to go. that takes all
of 5 minutes - which is far more valueable to me than to spoon-feed a lazy
programmer (read, you).
Steve [ Do, 22 März 2007 00:33 ] [ ID #1664373 ]
PHP » alt.php » continental state function

Vorheriges Thema: Need advice on which way is the best to pass variables
Nächstes Thema: fsockopen() Cookie problem Maximum execution time of 30 seconds exceeded