ignore case

Posted on 2009-04-23
Last Modified: 2012-05-06
hello there,
I have this code here to look for words from an array but I would like to ignore the case..
right now the array contains this


so all the links from the website are coming with lower case and im able to get the first 3
but ebooks its not showing because of the second capital letter..



if(isset($type) && (in_array(strtolower($type),$allowed_types) || in_array($type,$allowed_types) || in_array(ucfirst($type),$allowed_types) || in_array(strtoupper($type),$allowed_types))) {





Open in new window

Question by:XK8ER
    1 Comment
    LVL 39

    Accepted Solution

    Try this:

    if(isset($type) && in_array(strtolower($type),array_map('strtolower',$allowed_types))) {

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    A colleague recently asked me about how to give his client a small part of the web site that could be completely under the client's control.  Since I have done this sort of thing before to add emergency banners to a web site, I decided I would creat…
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to dynamically set the form action using jQuery.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now