I have a text like this:
Paul loves Anna, Anna loves John, and John loves Betty. Unluckily, Betty loves Paul. Paul now hates Anna because she loves John. But John loves Betty, and that's why Anna is sad. Now Anna would like to marry Paul, but it's too late.
and I need to replace the first occurrence of each name. Do I need to use preg_replace_callback
? Is there any simpler solution?