← All docs

str_starts_with()

Checks if a string starts with a given substring.

str_starts_with()

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

Checks if a string starts with a given substring.

Parameters:

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

Returns: bool

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

Internals

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