Baseball Posted December 24, 2009 Share Posted December 24, 2009 strtolower i need to add it to this to work, iuno how. $moderators = array('Admin', 'banana', 'orange'); if (in_array("{$_SESSION['user_name']}", $moderators)) print('Found it!'); i want str to lower to be added cause i need it to ignore if it's upper or lowercase letters by making it all lowercase olol Quote Link to comment https://forums.phpfreaks.com/topic/186295-help-adding-strtolower-to-my-in_array/ Share on other sites More sharing options...
rajivgonsalves Posted December 24, 2009 Share Posted December 24, 2009 you should use array_map $moderators = array('Admin', 'banana', 'orange'); if (in_array("{$_SESSION['user_name']}", array_map('strtolower', $moderators))) print('Found it!'); Quote Link to comment https://forums.phpfreaks.com/topic/186295-help-adding-strtolower-to-my-in_array/#findComment-983838 Share on other sites More sharing options...
.josh Posted December 25, 2009 Share Posted December 25, 2009 should probably strtolower the session var too... $moderators = array('Admin', 'banana', 'orange'); if (in_array(strtolower($_SESSION['user_name']), array_map('strtolower', $moderators))) print('Found it!'); Quote Link to comment https://forums.phpfreaks.com/topic/186295-help-adding-strtolower-to-my-in_array/#findComment-983873 Share on other sites More sharing options...
Baseball Posted December 25, 2009 Author Share Posted December 25, 2009 ty crayon Quote Link to comment https://forums.phpfreaks.com/topic/186295-help-adding-strtolower-to-my-in_array/#findComment-983903 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.