str_starts_with

PHP 8
str_starts_with - Checks if a string starts with a given substring

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

Performs a case-sensitive check indicating if haystack begins with needle.

Parameters

haystack

The string to search in.

needle

The substring to search for in the haystack.

Return Values

Returns true if haystack begins with needle, false otherwise.

Notes

Note:

This function is binary-safe.

Related Functions

Example of str_starts_with

Show all examples for str_starts_with

PHP Version:


Function str_starts_with:

Strings Functions

Most used PHP functions