array_search case insensitive

Case Insensitive Array Search PHPPHP’s array_search claims that it suppors a case insensitive search, well, sort of, with this message:

If needle is a string, the comparison is done in a case-sensitive manner.

user says:

for case insensitive array_search you could use:

function array_search_i($str,$array){ 
    foreach($array as $key => $value) { 
        if(stristr($str,$value)) return $key; 
    return false; 

stefano says:

for searching case insensitive better this:


Related Posts:

  • No Related Posts
This entry was posted in Tech Tips, Web Development and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *