PHP 8.0 added str_contains(), which tells you whether one string contains another, but it's case-sensitive. This RFC from Adam Cable proposed str_icontains(), a version that ignores case.

Show me

Today you have to use stripos() or lowercase both strings first:

stripos($string, 'FOX') !== false; // true

str_contains(strtolower($string), strtolower('FOX')); // true

With the RFC, you'd write:

$string = "The quick brown fox jumps over the lazy dog.";

str_icontains($string, 'fox'); // true
str_icontains($string, 'FOX'); // true
str_icontains($string, 'Fox'); // true

The name follows the pattern of str_replace() and str_ireplace(), where the i means "ignore case."

How it works

The function would only fold ASCII letters, a to z and A to Z, which matches how stripos() and str_ireplace() behave. Letters outside that range, like accented characters, would not match across case.

Full UTF-8 support was left out on purpose. The RFC says that belongs in a separate, larger proposal about multibyte strings.

Why it wasn't in PHP 8.0

The author looked back at the original str_contains() discussion and found two reasons a case-insensitive version was left out:

  • Some people felt it didn't add enough over calling strtolower().
  • The ASCII versus UTF-8 question was contentious, and adding it might have sunk the whole str_contains() RFC.

The author argued that now that str_contains() is settled, a matching case-insensitive version is the natural next step.

What it means for existing code

Nothing would break, since the RFC only adds a new function.

The vote

It was declined 6 to 11, short of the two-thirds majority it needed. Voting closed on July 16, 2025.