I have a database that employees use to add comments, along with other information. The comments can get rather long and I'd like to know if there's a way to get only the text that changed.
Example:
$before_text = "This is a long piece of text where the employee has made a comment about the STARTER of their project. Notes and information go here, blah, blah, blah...";
$after_text = "This is a long piece of text where the employee has made a comment about the STATUS of their project. Notes and information go here, blah, blah, blah...";
When I compare the two, I get the fact that the text has changed from $before_text
to $after_text
, but I'd like to end up with a variable like this:
$change = "'STARTER' changed to 'STATUS'";
... so that I can put that into a log. Some of these comments are really long and I'd had to end up with a log that has two large entries to describe what changed.
Is there a way to extract only the text that has changed between two text/string variables?