Preferably PHP solutions -- but any ideas would be great.
Give a text blob
'This is a super string of some content whree I want to find red sweaters and purple elephants. The purple elephants will count twice. and the red sweaters will count 3 times since red sweaters occurs three times'
and a phrase list
'red sweaters, purple elephants'
want to search the text blob and return count of occurances
therefore
red sweaters = 3 and purple elephants = 2