Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.