Case insensitive PHP in_array()

Simple function for using in_array() with case insensitive querying.

function i_in_array($needle, $haystack) 
{
    return in_array(strtolower($needle), array_map("strtolower", $haystack));
}

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.