Loading…

How to check if a string contains a character or word in PHP?

An example is given below:

Example

                                        

$mainString = "I am Bestinterviewquestion.com";
$searchedString = "am";

if( strpos( $mainString, $searchedString ) !== false) {
    echo "\"am\" exists in the main string";
}

Suggest An Answer

No suggestions avaliable!

Latest post from PHP Strings

Ask Question