← All built-ins / strstr()

strstr()

strstr(string $haystack, string $needle): string

Parameters

NameTypeDescription
$haystackstringstring to search in
$needlestringstring to search for

Return value

The part of $haystack starting at the first $needle, or false when not found.

Example

echo strstr("user@mail.com", "@"), "
";
var_dump(strstr("user@mail.com", "!") === false);
@mail.com
bool(true)

See also

strpos()str_contains()