Question:
is it better to store user names as upper and lower case? should they bee
converted to one case?
I have a script the checks for names and ...
Mark is not the same as mark, or MaRk ...
is there a way of making a string into lower case?
--
Philip J. Newman.
Head Developer
[EMAIL
LOL got a reply to this before i ever got the message my self ...
- Original Message -
From: Philip J. Newman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, March 02, 2003 10:56 AM
Subject: [PHP] Upper and lower case.
Question:
is it better to store user names as upper
is it better to store user names as upper and lower case? should they
bee
converted to one case?
Store it where? It depends if the place you store it in and the
comparisons there are going to be case sensitive or not. Most database
fields are going to be case sensitive while a PHP comparison
]]
Sent: 07 August 2001 16:24
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Upper or Lower Case
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.
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 getting into good
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)) // why
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
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 accross
8 matches
Mail list logo