strpos() function

Return the index of a regular expression in a string.

Syntax

strpos(haystack, needle)

Returns -1 if the expression isn't found.

Arguments

haystack → is string. The string that is to be searched.
needle → is string. The regular expression to look for.

Example

strpos('HELLO WORLD','WORLD') → 6
strpos('HELLO WORLD','GOODBYE') → -1