I've been trying to figure this one out for a bit... I even downloaded MediaWiki and looked at their diff script, but I couldn't make heads or tails out of it. I am making a content management system, that will have revision history saved on it. However, revision history is pointless unless you can analyze the difference. I have very simplistic needs beyond that, and a lot of systems out there are very complicated, and I am nowhere near smart enough to figure them out.
http://en.wikipedia.org/wiki/Help:Diff
I want to input two variables:
- $old (which is the source code of the left)
- $new (which is the source code of the right)
Then I want to receive back an array matrix of results. Each element of the array is a row, like what you see in the wikipedia link above. Each element should have 4 values...
- $oldDiff (which will be the modifier of the left, usually blank, + or -)
- $newDiff (which will be the modifier of the right, usually blank, + or -)
- $oldLine (the line of text for the left)
- $newLine (the line of text for the right)
Thats it... pretty simple results. I can analyze the array matrix myself and output the results within my script.