I must agree with Don that strcasecmp is the best way
to go. Combined with the 'trim' function this is
completely foolproof.
Thanks, Don!
Bjorn Van Simaeys
www.bvsenterprises.com
--- Don Read <[EMAIL PROTECTED]> wrote:
>
> On 07-Aug-2001 Bjorn Van Simaeys wrote:
> > Hi,
> >
> > I have run a
Also keep in mind that sometimes spaces find their ways into the string
and using trim() will get rid of them. Something like :
if (strcasecmp('neo',trim($name)) == 0) {
echo 'You chose our Neo line of goods, way to go!';
}
Not to say spaces randomly attach to strings :-) but to be saf
On 07-Aug-2001 Bjorn Van Simaeys wrote:
> Hi,
>
> I have run accross this problem too, and I solve it
> this way:
>
> if(strtolower($name1) == strtolower($name2))
>
> I compare both variables in lower case, this way
> capitals don't matter at all.
>
>
if (0 == strcasecmp('neo', $name)) //
>What happens if they type "NeO", or "NEO", or "nEo", or "neO" (etc)? ;)
>Also, if you're using this in a large application (or intend to in the
>future), are you going to type out all of the names as you have done with
>the neo example?
>Bjorn's method is much better, and you're better off gettin
== "neo" || $name == "Neo")
>
>
> -Original Message-----
> From: Bjorn Van Simaeys [mailto:[EMAIL PROTECTED]]
> Sent: 07 August 2001 16:24
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Upper or Lower Case
>
>
> Hi,
>
> I have run accr
Ok thanks,
I found jons way the easiest:
if ($name == "neo" || $name == "Neo")
-Original Message-
From: Bjorn Van Simaeys [mailto:[EMAIL PROTECTED]]
Sent: 07 August 2001 16:24
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Upper or Lower Case
Hi,
I have run accross t
Hi,
I have run accross this problem too, and I solve it
this way:
if(strtolower($name1) == strtolower($name2))
I compare both variables in lower case, this way
capitals don't matter at all.
Greetz,
Bjorn Van Simaeys
www.bvsenterprises.com
--- Tarrant Costelloe <[EMAIL PROTECTED]> wrote:
> W
7 matches
Mail list logo