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 Quote 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 Quote 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() Quote Link to comment https://forums.phpfreaks.com/topic/110421-case-insensitive-in_array/#findComment-566518 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.