Jump to content

How to check a string for words in an array


etrader

Recommended Posts

There's a few ways to check for items, it's all in how you set it up..what you are looking for..and what kind or results you expect. These are things you have to do unique to your project with making some checks and balances somehow.

 

Sometimes you need to use a mixture to get the exact desired results.

 

You may even have to explode the array and a foreach just to clean it up a bit before checking it.

 

some useful stuff

I usually stick to preg_match,preg_match_all,preg_quote,in_array for the most part.

http://php.net/manual/en/function.preg-match.php

http://www.php.net/manual/en/function.preg-match-all.php

http://www.php.net/manual/en/function.preg-quote.php

http://php.net/manual/en/function.array-search.php

 

The code that sasa gave is most likely what you need, you need to adjust the pattern for how you exactly want to look for items.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.