Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 11-27-2004, 04:13 AM   #1 (permalink)
 
Newb Techie

Join Date: Sep 2004

Posts: 19

The-Chihuahua

Send a message via ICQ to The-Chihuahua
Default Php case sensitivity

I very new to PHP, as in just started messing around with a scipt an hour ago, and I need some help (already) here is the problem

my code is like this
if ($sysdat=='other') echo "Example Other";

but incase of a misstype I want the case sensitivity removed, the only way I can think of doing it is

if ($sysdat=='other' || $sysdat=='Other' || $sysdat=='OTher' || $sysdat=='OtHer' (ect ect... ) echo "Example Other";

is there a way I can have it assume that the case in nonimportant?
The-Chihuahua is offline  
Old 11-28-2004, 12:25 PM   #2 (permalink)
 
Monster Techie

Join Date: Jul 2003

Posts: 1,179

Emily is on a distinguished road

Send a message via AIM to Emily
Default

There's an easy way to do this... There's a function strtolower() (also a strtoupper) that will change any string to lowercase. So your code would look like this:

if (strtolower($sysdat)=='other') echo "Example Other";

Hope this helped.
__________________
<a href=\"http://www.upstark.com\">www.upstark.com</a>
Emily is offline  
Old 11-28-2004, 10:04 PM   #3 (permalink)
 
Newb Techie

Join Date: Sep 2004

Posts: 19

The-Chihuahua

Send a message via ICQ to The-Chihuahua
Default

so even if it is typed OtHer it will change it to other, then compare it to 'other', ill test it right now, if thats wrong ill know in a bit
The-Chihuahua is offline  
Old 11-28-2004, 10:08 PM   #4 (permalink)
 
Newb Techie

Join Date: Sep 2004

Posts: 19

The-Chihuahua

Send a message via ICQ to The-Chihuahua
Default

it works, thanks man
The-Chihuahua is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On