Remove duplicate sentences from a paragraph
So what is the best way of removing duplicate phrases from a paragraph?
$paragraph = "A cow jumped over the moon. It mooed with delight. A cow
jumped over the moon. It mooed with delight. A cow jumped over the
moon. It mooed with delight. A cow jumped over the moon. It mooed
with delight. A cow jumped over the moon. Hello world. It mooed with delight. A cow
jumped over the moon. It mooed with delight. A cow jumped over the
moon. It mooed with delight.";
$phrase = "A cow jumped over the moon. It mooed with delight.";
I'd like to end up with:
$paragraph = "A cow jumped over the moon. It mooed with delight. Hello world.";
$paragraph = "A cow jumped over the moon. It mooed with delight. A cow
jumped over the moon. It mooed with delight. A cow jumped over the
moon. It mooed with delight. A cow jumped over the moon. It mooed
with delight. A cow jumped over the moon. Hello world. It mooed with delight. A cow
jumped over the moon. It mooed with delight. A cow jumped over the
moon. It mooed with delight.";
$phrase = "A cow jumped over the moon. It mooed with delight.";
I'd like to end up with:
$paragraph = "A cow jumped over the moon. It mooed with delight. Hello world.";
