The strpos function in PHP is used to determine whether a string is contained in another string.
If there is a string A that contains the following words “The cat is sleeping” and you have another string B that contains this “cat”
One could use the strpos function to determine whether string B belongs to any element is string A. In this case the word cat from string B is present in string A
The If Statement
Will return True since string B belongs to string A
The common use of this function is to determine the position of the first occurrence of the substring in a string