Task:
Replace a string using advanced matching
Example:
$needle="pretty blue day"
$haystack="It was blue and pretty day yesterday"
Match "blue and pretty day", meaning the $needle can be permuted and additional words can be inserted in between (one or two words max, if possible this would be a setting).
Advanced search
Moderator: General Moderators
Re: Advanced search
use explode() to break up the words, then str_replace() to replace each one in the string?
Re: Advanced search
I can explode them but I need to replace the whole matched phrase afterward - "blue and pretty day" in the example is replaced with something. I have trouble joining these up.dhrosti wrote:use explode() to break up the words, then str_replace() to replace each one in the string?