I'm trying to code a site that will allow multiple people to be working on a file at the same time. In doing so, the biggest road-block I have come across is merging the new versions of the files, version-control style.
I have been unable to find anything in the vein of a built-in JavaScript or PHP function that will help me with this. The closest I have found is array_diff, which really isn't what I need, since that simply returns what elements are not present in the other array, and if I have an array of words, there are bound to be repeats; additionally, array_diff ignores the number of times something shows up or its position in the file.
I have looked a little into Levenshtein's distance algorithm, which does come built-in as a function with php, but I'm not sure if it's what I need. If so, please tell me, and I will look into that further.
Is there anything that you know of that will suit my needs?
EDIT:
Let me clarify a little. I am not actually designing a version control system. I only want to merge the files, not store old versions, etc. Is installing a CVS or SVN or something along those lines still my best bet just to get use of the one function?