The strchr() function is used to find the first appearance of a string inside another string. It is the pseudonym of the strstr() function. This function was introduced in PHP3.
Syntax:
strchr(string $haystack, string $needle, bool $before_needle = false): string|false
For instance:
$record = "Fred,Flintstone,35,Wilma"; $rest = strchr($record, ","); // $rest is ",Flintstone,35,Wilma"
The variations on strstr() are:
stristr(): Case-insensitive strstr().
strchr(): Alias for strstr().
strrchr(): Find last occurrence of a character in a string.