← All docs

strpos()

Finds the numeric position of the first occurrence of a substring.

strpos()

function strpos(string $haystack, string $needle, int $offset = 0): mixed

Finds the numeric position of the first occurrence of a substring.

Parameters:

  • $haystack (string)
  • $needle (string)
  • $offset (int), default 0, optional

Returns: mixed

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

Internals

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