PHP strchr() Function

The strchr() function searches for the first occurrence of a string inside another string.

This function is an alias of the strstr() function.

Example -

ParameterDescription
stringRequired. Specifies the string to search
searchRequired. Specifies the string to search for. If this parameter is a number, it will search for the character matching the ASCII value of the number
before_searchOptional. A boolean value whose default is "false". If set to "true", it returns the part of the string before the first occurrence of the search parameter.