← All built-ins / strchr()

strchr()

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

Parameters

NameTypeDescription
$haystackstringstring to search in
$needlestringstring to search for

Return value

Alias of strstr().

Example

echo strchr("a/b/c.txt", "/");
/b/c.txt

See also

strstr()basename()