Php case sensitivity

Status
Not open for further replies.

The-Chihuahua

Solid State Member
Messages
19
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?
 
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. :)
 
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
 
Status
Not open for further replies.
Back
Top Bottom