Nolok Imes
Nolok Imes

Reputation: 1

Finding a word in a set of characters PHP

I'm looking for a way to find out if a word is somewhere in a set of characters. For example if the word "looking" is in "hereisthewordim*looking*for"

if( strpos("looking", "hereisthewordimlookingfor")  !== false) {
 echo "true";
}

Upvotes: 0

Views: 82

Answers (2)

GDP
GDP

Reputation: 8178

I think you're looking for this:

if(stristr("hereisthewordimlookingfor","looking")) {
    echo "true";
};

Upvotes: 0

Alon Eitan
Alon Eitan

Reputation: 12025

You need to replace the parameters:

strpos("hereisthewordimlookingfor", "looking")

Upvotes: 2

Related Questions