SF23103 Posted August 23, 2014 Share Posted August 23, 2014 Is there a way to change the statement below so that it ignores case sensitivity of the variable? for instance, the statement would be true if $category == 'Admissions', 'ADMISSIONS', 'admissions', etc. For some reason I'm having the worst time finding this via google search and know y'all will be able to help! if ($category == 'Admissions') { echo ' <a href="#">-Forms</a><br /> <a href="#">-Tuition</a><br />'; } ?> Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/290622-case-sensitivity-ifthen-statement/ Share on other sites More sharing options...
Solution CroNiX Posted August 23, 2014 Solution Share Posted August 23, 2014 (edited) if (strtolower($category) == 'admissions') { Convert it to lower case and check against lower case Edited August 23, 2014 by CroNiX Quote Link to comment https://forums.phpfreaks.com/topic/290622-case-sensitivity-ifthen-statement/#findComment-1488748 Share on other sites More sharing options...
requinix Posted August 23, 2014 Share Posted August 23, 2014 Or strcasecmp. Quote Link to comment https://forums.phpfreaks.com/topic/290622-case-sensitivity-ifthen-statement/#findComment-1488757 Share on other sites More sharing options...
SF23103 Posted August 24, 2014 Author Share Posted August 24, 2014 Perfect. As long as I remember to check against lower case ;-) You saved the day again... Quote Link to comment https://forums.phpfreaks.com/topic/290622-case-sensitivity-ifthen-statement/#findComment-1488761 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.