I am trying to merge multi line strings. I have written the code for merging data which doesn't have "/n" character but unable to proceed with it. What I need to achieve is, comparing ancestor node with a remote node and local node and merging changes of either remote or local in ancestor line by line. Each line should be compared between $ancestor->$remote
and $ancestor->$local
and updated in ancestor.
For example: 3rd line is changed in remote but not local, so all changes from line 3 of $remote
should be merged into $ancestor and same should happen with 6th line of $local
if there is a change in line 6.
Another Example:
$ancestor = "This is a
normal comment"
$remtote = "This is not a
normal comment"
$local = "This is a
abnormal comment"
$expected_result = "This is not a
abnormal comment"