I am programming a template management system. In my script users have the ability to large blocks of text. I want to track the changes they make. For example: Body of text stored in the database: Fish are aquatic vertebrates that are typically cold-blooded, covered with scales, and equipped with two sets of paired fins and several unpaired fins. Fish are abundant in the sea and in fresh water, with species being known from mountain streams (e.g., char and gudgeon) as well as in the deepest depths of the ocean (e.g., gulpers and anglerfish). User edits the above paragraph to (I have bolded what is changed): Tigers are aquatic vertebrates that are typically warm-blooded, covered with scales, and equipped with two sets of paired fins and one unpaired fins. Fish are abundant in the sea and in fresh water, with species being known from plain streams (e.g., char and gudgeon) as well as in the deepest depths of the ocean (e.g., gulpers). PHP would output: - Changed "Fish" to "Tigers". - Changed "cold-blooded" to "warm-blooded". - Changed "mountain" to "plain". - Deleted "and anglerfish". -------- What is the easiest way to do this?
I don't know of an automatic way to do what you want. I would probably break the text into words (explode by spaces) and loop through the whole original while comparing it to the new text - word by word. It should work...