← All docs

strstr()

Returns the portion of a string starting at the first occurrence of a substring.

strstr()

function strstr(string $haystack, string $needle, bool $before_needle = false): string

Returns the portion of a string starting at the first occurrence of a substring.

Parameters:

  • $haystack (string)
  • $needle (string)
  • $before_needle (bool), default false, optional

Returns: string

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

Internals

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