Question

Is there a chance to search in the preg_grep input with non case sensitive search?

$checkAuth = preg_grep("/CN=".$cn_name."/", $entries[0]["member"]);

The cn_name can be with upper and lower case, but it works only with the correct case sensitive name. I know, the preg_match can be used with an "i" like:

preg_match("/php/i", "PHP is the web scripting language of choice.")

but preg_match requires a string and is not working with a array.

Was it helpful?

Solution

Just do

$checkAuth = preg_grep("/CN=".$cn_name."/i", $entries[0]["member"]);

preg_grep and preg_match both use PCRE patterns

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top