moon 111 Posted June 16, 2008 Share Posted June 16, 2008 I've tried Googling it (and Yahoo!ing it) but I can't find anything. I need something like in_array except case insensitive. Thanks Link to comment https://forums.phpfreaks.com/topic/110421-case-insensitive-in_array/ Share on other sites More sharing options...
.josh Posted June 16, 2008 Share Posted June 16, 2008 you can do a foreach loop on the array and do a strcasecmp on each needle/element, or if you look at in_array in the manual in the notes towards the bottom there's a function provided using preg_grep Link to comment https://forums.phpfreaks.com/topic/110421-case-insensitive-in_array/#findComment-566515 Share on other sites More sharing options...
rhodesa Posted June 16, 2008 Share Posted June 16, 2008 or, in the foreach, wrap the test case and value with strtolower() Link to comment https://forums.phpfreaks.com/topic/110421-case-insensitive-in_array/#findComment-566518 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.