質問

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.

役に立ちましたか?

解決

Just do

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

preg_grep and preg_match both use PCRE patterns

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top