How To Check If String Contains A Specific Word in Php?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/check-string-contains-specific-word-php/
PINTEREST
PINTEREST
INSTAGRAM

I have a string and want to check if the string provides some word I want to look. For example the string is like below

There are different way to achive this we will look them below.

By Using strpos

strpos is a Php function used to find given word position in a string. If the word exist strpos will return the the start position of the word in the string if not it will return -1 .

By Using preg_match

preg_match is a regular expression match and gives more details to check. We can look complex words but for now we just look simple word match.

LEARN MORE  Things To Do With Computer When Bored

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)