Jump to content

PHP function similar to MySQL LIKE?


Jerred121

Recommended Posts

I'm pretty sure there isn't, but I was wondering if there was a php function that would return partial matches similar to MySQL's LIKE, I've been searching for a while and haven't found one.  If not, is there a class or something that someone knows of that will accomplish a like of search or a string comparison?  I want to be able to compare two variables and return one of three results - Exact Match, Partial Match, No Match.

 

I suppose regex may do the trick but I'm a complete novice when it comes to regex and I have no idea where to even begin.

 

Thanks for any suggestions.

Link to comment
https://forums.phpfreaks.com/topic/226390-php-function-similar-to-mysql-like/
Share on other sites

I'd start with a tutorial on regex... it is not that hard to get your hand around when you sit down and power through it. Just don't try and remember every character etc.. look them up and focus on what the regex functions themselves are doing. It is usually pretty easy to find a pattern that is close and manipulate it to what you need.

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.