Saved X
Google login
SignUp with Email

How to Check If a String Contains a Specific Word in PHP

theindreshverma ( Edited  26 Oct 2021, 08:11 pm )

$word = "printing";
$mystring = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
// test if string contains the word 
if(strpos($mystring, $word) !== false){
    echo "Word Found!";
} else{
    echo "Word Not Found!";

Sourcecode Tags

More Sourcecodes

More Sourcecodes