PHP code to check if a string is a part of another string

That is a fairly simple peace of code that I always get to search for when I need it. That is why I decided to put it into my blog so that I could have an eased access to it when I need it.

This simple code helps me find whether a given string is a part of a larger string.

if(strpos($text_to_search, $text_to_find)===true)
{
     //some code
}
else
{
    //another code
}

The key here is the triple equal sign…

Categories