How to match one long string phrase against another in PHP?
Posted: Mon Sep 15, 2008 11:50 pm
I am a bit confused on how to go about doing a match of one string against another. This is what I want to achieve:
String 1: You have selected tea, biscuits and an ice-cream.
String 2: Tea, Coffee, Biscuits, Ice-cream, Chocolates, Fruits
I want to match "String 1" against "String 2" and return "String 1" with all the matching words highlighted in yellow. So in this case, "String 1" would return with "tea", "biscuits" and "ice-cream" highlighted in yellow.
How would I go about this?
String 1: You have selected tea, biscuits and an ice-cream.
String 2: Tea, Coffee, Biscuits, Ice-cream, Chocolates, Fruits
I want to match "String 1" against "String 2" and return "String 1" with all the matching words highlighted in yellow. So in this case, "String 1" would return with "tea", "biscuits" and "ice-cream" highlighted in yellow.
How would I go about this?