← All docs

str_contains()

Determines if a string contains a given substring.

str_contains()

function str_contains(string $haystack, string $needle): bool

Determines if a string contains a given substring.

Parameters:

  • $haystack (string)
  • $needle (string)

Returns: bool

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how str_contains is implemented in the compiler, see the internals page.